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

Fix the cloud account repository update method #604

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions fixbackend/cloud_accounts/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ async def do_updade() -> CloudAccount:
stored_account.failed_scan_count = cloud_account.failed_scan_count
stored_account.last_task_id = cloud_account.last_task_id
stored_account.last_scan_resources_errors = cloud_account.last_scan_resources_errors
stored_account.last_degraded_scan_started_at = cloud_account.last_degraded_scan_started_at

self._update_state_dependent_fields(stored_account, cloud_account.state)

Expand Down
2 changes: 2 additions & 0 deletions tests/fixbackend/cloud_accounts/repository_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def update_account(account: CloudAccount) -> CloudAccount:
last_scan_resources_scanned=456,
last_scan_started_at=timestamp,
next_scan=timestamp + timedelta(hours=1),
last_degraded_scan_started_at=timestamp + timedelta(hours=1),
),
)
with_last_scan = await cloud_account_repository.get(id=configured_account_id)
Expand All @@ -209,6 +210,7 @@ def update_account(account: CloudAccount) -> CloudAccount:
assert with_last_scan.last_scan_resources_scanned == 456
assert with_last_scan.last_scan_started_at == timestamp
assert with_last_scan.next_scan == next_scan
assert with_last_scan.last_degraded_scan_started_at == timestamp + timedelta(hours=1)

# delete
await cloud_account_repository.delete(id=configured_account_id)
Expand Down
Loading