From ce950edede05e3fbd7d3545eab94b6f5b5bf7d14 Mon Sep 17 00:00:00 2001 From: Michael Collins <15347726+michaeljcollinsuk@users.noreply.github.com> Date: Fri, 10 Jan 2025 16:38:21 +0000 Subject: [PATCH] Fix failing tests --- tests/api/filters/test_app_filter.py | 4 ++-- tests/api/filters/test_users3bucket_filter.py | 6 +++--- tests/frontend/views/test_app.py | 2 +- tests/frontend/views/test_app_variables.py | 2 +- tests/frontend/views/test_datasource.py | 8 ++++++-- tests/frontend/views/test_parameter.py | 2 +- tests/frontend/views/test_secrets.py | 2 +- tests/frontend/views/test_user.py | 2 +- 8 files changed, 16 insertions(+), 12 deletions(-) diff --git a/tests/api/filters/test_app_filter.py b/tests/api/filters/test_app_filter.py index fb7a3dd17..af4cc7ae9 100644 --- a/tests/api/filters/test_app_filter.py +++ b/tests/api/filters/test_app_filter.py @@ -6,8 +6,8 @@ class AppFilterTest(APITestCase): def setUp(self): - self.superuser = baker.make("api.User", is_superuser=True) - self.app_admin = baker.make("api.User", is_superuser=False) + self.superuser = baker.make("api.User", auth0_id="github|superuser", is_superuser=True) + self.app_admin = baker.make("api.User", auth0_id="github|user", is_superuser=False) self.app_1 = baker.make("api.App", name="App 1") self.app_2 = baker.make("api.App", name="App 2") baker.make("api.UserApp", user=self.app_admin, app=self.app_1, is_admin=True) diff --git a/tests/api/filters/test_users3bucket_filter.py b/tests/api/filters/test_users3bucket_filter.py index efafb2089..96afaa4f6 100644 --- a/tests/api/filters/test_users3bucket_filter.py +++ b/tests/api/filters/test_users3bucket_filter.py @@ -10,9 +10,9 @@ class UserS3BucketFilterTest(APITestCase): def setUp(self): - self.superuser = baker.make("api.User", is_superuser=True) - self.normal_user = baker.make("api.User", is_superuser=False) - self.other_user = baker.make("api.User", is_superuser=False) + self.superuser = baker.make("api.User", auth0_id="github|superuser", is_superuser=True) + self.normal_user = baker.make("api.User", auth0_id="github|user", is_superuser=False) + self.other_user = baker.make("api.User", auth0_id="github|other_user", is_superuser=False) self.s3bucket_1 = baker.make("api.S3Bucket", name="test-bucket-1") self.s3bucket_2 = baker.make("api.S3Bucket", name="test-bucket-2") diff --git a/tests/frontend/views/test_app.py b/tests/frontend/views/test_app.py index 6ed554c85..371e19b27 100644 --- a/tests/frontend/views/test_app.py +++ b/tests/frontend/views/test_app.py @@ -46,7 +46,7 @@ def github_api_token(): def users(users): users.update( { - "app_admin": baker.make("api.User", username="app_admin"), + "app_admin": baker.make("api.User", auth0_id="github|user", username="app_admin"), } ) return users diff --git a/tests/frontend/views/test_app_variables.py b/tests/frontend/views/test_app_variables.py index a38b51101..8e3360e33 100644 --- a/tests/frontend/views/test_app_variables.py +++ b/tests/frontend/views/test_app_variables.py @@ -14,7 +14,7 @@ def users(users): users.update( { - "owner": baker.make("api.User", username="owner"), + "owner": baker.make("api.User", auth0_id="github|user", username="owner"), } ) return users diff --git a/tests/frontend/views/test_datasource.py b/tests/frontend/views/test_datasource.py index 46c3fa5c8..6022ac498 100644 --- a/tests/frontend/views/test_datasource.py +++ b/tests/frontend/views/test_datasource.py @@ -23,8 +23,12 @@ def enable_db_for_all_tests(db): def users(users): users.update( { - "bucket_viewer": baker.make("api.User", username="bucket_viewer"), - "bucket_admin": baker.make("api.User", username="bucket_admin"), + "bucket_viewer": baker.make( + "api.User", auth0_id="github|bucket_viewer", username="bucket_viewer" + ), + "bucket_admin": baker.make( + "api.User", auth0_id="github|bucket_admin", username="bucket_admin" + ), } ) return users diff --git a/tests/frontend/views/test_parameter.py b/tests/frontend/views/test_parameter.py index 60b1b40ab..2d3794485 100644 --- a/tests/frontend/views/test_parameter.py +++ b/tests/frontend/views/test_parameter.py @@ -12,7 +12,7 @@ def users(users): users.update( { - "owner": baker.make("api.User", username="owner"), + "owner": baker.make("api.User", auth0_id="github|user", username="owner"), } ) return users diff --git a/tests/frontend/views/test_secrets.py b/tests/frontend/views/test_secrets.py index b7d604b4e..33518d436 100644 --- a/tests/frontend/views/test_secrets.py +++ b/tests/frontend/views/test_secrets.py @@ -36,7 +36,7 @@ def github_api_token(): def users(users): users.update( { - "app_admin": baker.make("api.User", username="app_admin"), + "app_admin": baker.make("api.User", auth0_id="github|user", username="app_admin"), } ) return users diff --git a/tests/frontend/views/test_user.py b/tests/frontend/views/test_user.py index 9864e7baf..938eebf63 100644 --- a/tests/frontend/views/test_user.py +++ b/tests/frontend/views/test_user.py @@ -112,7 +112,7 @@ def test_permission(client, users, view, user, expected_status): @pytest.mark.parametrize( "view,user,expected_count", [ - (list, "superuser", 5), + (list, "superuser", 6), ], ) def test_list(client, users, view, user, expected_count):