Skip to content

Commit

Permalink
Fix the cloud account repository update method (#604)
Browse files Browse the repository at this point in the history
  • Loading branch information
meln1k authored Sep 2, 2024
1 parent 99a2b42 commit c38357d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
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

0 comments on commit c38357d

Please sign in to comment.