From 7ee685a2cfbbc743e4b12535c73e4d7e3cad5044 Mon Sep 17 00:00:00 2001 From: notoraptor Date: Fri, 17 Jan 2025 11:44:35 -0500 Subject: [PATCH 1/2] Remove unnecessary hardcoded value for admin_access (already handled in produce_fake_users) --- scripts/insert_hardcoded_values.py | 12 ------------ test_common/fake_data.json | 3 +-- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/scripts/insert_hardcoded_values.py b/scripts/insert_hardcoded_values.py index 002de3e4..1e3329c8 100644 --- a/scripts/insert_hardcoded_values.py +++ b/scripts/insert_hardcoded_values.py @@ -81,15 +81,6 @@ def get_job_user_props_hardcoded_values(fake_data: dict): ] -def ensure_admin_users(fake_data: dict): - """Make sure there is at least 1 fake admin.""" - users = fake_data["users"] - admin_users = [user for user in users if user.get("admin_access", False)] - if not admin_users and users: - users[0]["admin_access"] = True - assert [user for user in fake_data["users"] if user.get("admin_access", False)] - - def ensure_job_arrays(fake_data: dict): """Make sure some fake jobs belong to valid job arrays.""" jobs_with_array_id = [ @@ -141,9 +132,6 @@ def main(argv): # Insert fake job user props fake_data["job_user_props"] = get_job_user_props_hardcoded_values(fake_data) - # Make sure there are some admin users - ensure_admin_users(fake_data) - # Make sure some jobs are in valid job arrays ensure_job_arrays(fake_data) diff --git a/test_common/fake_data.json b/test_common/fake_data.json index 29c6e572..efaee8af 100644 --- a/test_common/fake_data.json +++ b/test_common/fake_data.json @@ -11,8 +11,7 @@ "nbr_items_per_page": 40, "dark_mode": false, "language": "en" - }, - "admin_access": true + } }, { "mila_email_username": "student01@mila.quebec", From b2fb51cc77ec30da58a2801af81b08e61788caeb Mon Sep 17 00:00:00 2001 From: notoraptor Date: Fri, 17 Jan 2025 11:56:30 -0500 Subject: [PATCH 2/2] Do not make any assumption on initial sorting for dashboard table --- clockwork_frontend_test/test_dashboard.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clockwork_frontend_test/test_dashboard.py b/clockwork_frontend_test/test_dashboard.py index 186c60fe..581fbaf5 100644 --- a/clockwork_frontend_test/test_dashboard.py +++ b/clockwork_frontend_test/test_dashboard.py @@ -173,8 +173,7 @@ def _check_dashboard_table_sorting( # Remove last column (row order) to get only expected content. content = [row[:-1] for row in sorted_content] SORTED_CONTENT = content - # We assume DASHBOARD_TABLE_CONTENT is not initially sorted anyway. - assert content != DASHBOARD_TABLE_CONTENT + # Expected content is now ready for checking. table = page.locator("table#dashboard_table") headers = table.locator("thead tr th")