-
Notifications
You must be signed in to change notification settings - Fork 10
Testing : Utility functions for test data setup #275
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
Changes from 12 commits
7cce873
ed4d950
8c91163
f809790
e266d23
b7f9cb5
51ecac5
3b81ec7
5d57469
7106272
c3cefc9
33b4f50
927a4b0
edcd009
b027651
f0f23d4
6d30776
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,6 +107,26 @@ def get_provider_credential( | |
| return None | ||
|
|
||
|
|
||
| def get_full_provider_credential( | ||
| *, session: Session, org_id: int, provider: str, project_id: Optional[int] = None | ||
| ) -> Optional[Dict[str, Any]]: | ||
| """Fetches credentials for a specific provider of an organization.""" | ||
| validate_provider(provider) | ||
|
|
||
| statement = select(Credential).where( | ||
| Credential.organization_id == org_id, | ||
| Credential.provider == provider, | ||
| Credential.is_active == True, | ||
| Credential.project_id == project_id if project_id is not None else True, | ||
| ) | ||
|
Comment on lines
+116
to
+113
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix the WHERE clause logic for project_id filtering. The current implementation has two critical issues:
Apply this diff to fix the WHERE clause: statement = select(Credential).where(
Credential.organization_id == org_id,
Credential.provider == provider,
- Credential.is_active == True,
- Credential.project_id == project_id if project_id is not None else True,
+ Credential.is_active,
+ Credential.project_id == project_id if project_id is not None else Credential.project_id.is_not(None),
)Note: This assumes that when 🧰 Tools🪛 Ruff (0.11.9)119-119: Avoid equality comparisons to Replace with (E712) 🤖 Prompt for AI Agents |
||
| creds = session.exec(statement).first() | ||
|
|
||
| if creds and creds.credential: | ||
| # Return the full Credential object | ||
| return creds | ||
| return None | ||
|
|
||
|
|
||
| def get_providers( | ||
| *, session: Session, org_id: int, project_id: Optional[int] = None | ||
| ) -> List[str]: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.