Skip to content

Commit

Permalink
Call complete when revoking all access succeeds (#1214)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljcollinsuk authored Oct 20, 2023
1 parent 4c28ece commit bb90837
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions controlpanel/api/tasks/handlers/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,5 @@ def handle(self, *args, **kwargs):

instance.current_user = task_user
instance.revoke_bucket_access()

self.complete()
4 changes: 3 additions & 1 deletion tests/api/tasks/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ def test_revoke_app_access(cluster, complete):
@patch("controlpanel.api.models.UserS3Bucket.revoke_bucket_access", new=MagicMock())
@patch("controlpanel.api.models.AppS3Bucket.revoke_bucket_access", new=MagicMock())
@patch("controlpanel.api.models.PolicyS3Bucket.revoke_bucket_access", new=MagicMock())
def test_revoke_all_access(users):
@patch("controlpanel.api.tasks.handlers.base.BaseTaskHandler.complete")
def test_revoke_all_access(complete, users):
bucket = mommy.make("api.S3Bucket")
user_access = mommy.make("api.UserS3Bucket", s3bucket=bucket)
app_access = mommy.make("api.AppS3Bucket", s3bucket=bucket)
Expand All @@ -133,3 +134,4 @@ def test_revoke_all_access(users):
user_access.revoke_bucket_access.assert_called_once()
app_access.revoke_bucket_access.assert_called_once()
policy_access.revoke_bucket_access.assert_called_once()
complete.assert_called_once()

0 comments on commit bb90837

Please sign in to comment.