-
Notifications
You must be signed in to change notification settings - Fork 70
LCORE-974: updated unit tests #1095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LCORE-974: updated unit tests #1095
Conversation
WalkthroughThis PR updates test files to accommodate two new parameters in core data models: a Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/unit/authentication/test_jwk_token.py (1)
213-219:⚠️ Potential issue | 🟡 MinorRemove the unnecessary pyright suppression.
All fields in
JwtConfigurationhave default values (user_id_claimdefaults toconstants.DEFAULT_JWT_UID_CLAIM,username_claimdefaults toconstants.DEFAULT_JWT_USER_NAME_CLAIM, androle_ruleshasdefault_factory=list). CallingJwtConfiguration()with no arguments is valid and does not produce areportCallIssue. The# pyright: ignore[reportCallIssue]comment on line 219 should be removed.
🧹 Nitpick comments (2)
tests/unit/authentication/test_api_key_token.py (1)
81-83: Type suppression pattern is acceptable but could be cleaner.The
isinstance(detail, dict)assertions on lines 82 and 107 should narrow the type, but the type checker doesn't always recognize this in assertion contexts. The# type: ignore[index]comments work but can mask real issues if the type ofdetailchanges.A slightly more robust pattern would be to assign after the type guard:
♻️ Optional: Cleaner type narrowing pattern
assert exc_info.value.status_code == 401 detail = exc_info.value.detail assert isinstance(detail, dict) - assert detail["cause"] == "No Authorization header found" # type: ignore[index] + assert detail["cause"] == "No Authorization header found"If the type checker still complains, consider using an intermediate variable:
assert isinstance(detail, dict) detail_dict: dict[str, str] = detail assert detail_dict["cause"] == "No Authorization header found"That said, the current approach is pragmatic and doesn't affect test correctness.
Also applies to: 106-108
tests/unit/app/endpoints/test_rags.py (1)
56-59: Type ignore comments are acceptable, but consider a cleaner pattern.The
# type: ignore[index]comments are necessary because Pyright doesn't narrowHTTPException.detail(typed asstr | dict[str, Any] | None) after theisinstance(detail, dict)assertion. This same pattern appears at lines 59, 161, and 189.A slightly cleaner alternative would be to assign to a typed variable after the isinstance check, which avoids scattering type ignores:
♻️ Optional refactor
detail = e.value.detail assert isinstance(detail, dict) - assert "response" in detail - assert "Unable to connect to Llama Stack" in detail["response"] # type: ignore[index] + response = detail.get("response") + assert response is not None + assert "Unable to connect to Llama Stack" in response
Description
LCORE-974: updated unit tests
Type of change
Tools used to create PR
Related Tickets & Documents
Summary by CodeRabbit