Skip to content
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

Set can_access_account flag to false when updating creds #642

Merged
merged 5 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions fixbackend/cloud_accounts/azure_subscription_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ async def upsert(
existing.client_id = client_id
existing.client_secret = client_secret
existing.created_at = utc() # update to trigger list_created_after
existing.updated_at = utc()
existing.can_access_azure_account = False
model = existing.to_model()
await session.commit()
return model
Expand All @@ -93,6 +95,7 @@ async def upsert(
azure_tenant_id=azure_tenant_id,
client_id=client_id,
client_secret=client_secret,
can_access_azure_account=False,
)
session.add(entity)
await session.commit()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async def test_store_azure_subscription(
client_secret = "foo_bar"
azure_credentials = await azure_repo.upsert(workspace.id, azure_tenant_id, client_id, client_secret)

assert azure_credentials.can_access_azure_account is None
assert azure_credentials.can_access_azure_account is False
assert azure_credentials.tenant_id == workspace.id
assert azure_credentials.azure_tenant_id == azure_tenant_id
assert azure_credentials.client_id == client_id
Expand Down