diff --git a/tests/app/main/views/test_manage_users.py b/tests/app/main/views/test_manage_users.py index 99d273ab8..d6aef8ead 100644 --- a/tests/app/main/views/test_manage_users.py +++ b/tests/app/main/views/test_manage_users.py @@ -20,8 +20,8 @@ from tests.conftest import ( ) -@pytest.mark.parametrize( # noqa: PT014 # Duplicate parameters have different permissions. - ("user", "expected_self_text", "expected_coworker_text"), +@pytest.mark.parametrize( + ("user", "expected_self_text", "add_details"), [ ( create_active_user_with_permissions(), @@ -34,16 +34,7 @@ from tests.conftest import ( "Can Manage settings, team and usage " "Can Manage API integration" ), - ( - "ZZZZZZZZ zzzzzzz@example.gsa.gov " - "Permissions " - "Can See dashboard " - "Cannot Send messages " - "Cannot Add and edit templates " - "Cannot Manage settings, team and usage " - "Cannot Manage API integration " - "Change details for ZZZZZZZZ zzzzzzz@example.gsa.gov" - ), + True, ), ( create_active_user_empty_permissions(), @@ -56,15 +47,7 @@ from tests.conftest import ( "Cannot Manage settings, team and usage " "Cannot Manage API integration" ), - ( - "ZZZZZZZZ zzzzzzz@example.gsa.gov " - "Permissions " - "Can See dashboard " - "Cannot Send messages " - "Cannot Add and edit templates " - "Cannot Manage settings, team and usage " - "Cannot Manage API integration" - ), + False, ), ( create_active_user_view_permissions(), @@ -77,15 +60,7 @@ from tests.conftest import ( "Cannot Manage settings, team and usage " "Cannot Manage API integration" ), - ( - "ZZZZZZZZ zzzzzzz@example.gsa.gov " - "Permissions " - "Can See dashboard " - "Cannot Send messages " - "Cannot Add and edit templates " - "Cannot Manage settings, team and usage " - "Cannot Manage API integration" - ), + False, ), ( create_active_user_manage_template_permissions(), @@ -98,36 +73,7 @@ from tests.conftest import ( "Cannot Manage settings, team and usage " "Cannot Manage API integration" ), - ( - "ZZZZZZZZ zzzzzzz@example.gsa.gov " - "Permissions " - "Can See dashboard " - "Cannot Send messages " - "Cannot Add and edit templates " - "Cannot Manage settings, team and usage " - "Cannot Manage API integration" - ), - ), - ( - create_active_user_manage_template_permissions(), - ( - "Test User With Permissions (you) " - "Permissions " - "Can See dashboard " - "Cannot Send messages " - "Can Add and edit templates " - "Cannot Manage settings, team and usage " - "Cannot Manage API integration" - ), - ( - "ZZZZZZZZ zzzzzzz@example.gsa.gov " - "Permissions " - "Can See dashboard " - "Cannot Send messages " - "Cannot Add and edit templates " - "Cannot Manage settings, team and usage " - "Cannot Manage API integration" - ), + False, ), ], ) @@ -140,8 +86,8 @@ def test_should_show_overview_page( service_one, user, expected_self_text, - expected_coworker_text, active_user_view_permissions, + add_details, ): current_user = user other_user = copy.deepcopy(active_user_view_permissions) @@ -164,11 +110,20 @@ def test_should_show_overview_page( assert ( normalize_spaces(page.select(".user-list-item")[0].text) == expected_self_text ) - # [1:5] are invited users - assert ( - normalize_spaces(page.select(".user-list-item")[6].text) - == expected_coworker_text + + expected = ( + "ZZZZZZZZ zzzzzzz@example.gsa.gov " + "Permissions " + "Can See dashboard " + "Cannot Send messages " + "Cannot Add and edit templates " + "Cannot Manage settings, team and usage " + "Cannot Manage API integration" ) + + if add_details is True: + expected = f"{expected} Change details for ZZZZZZZZ zzzzzzz@example.gsa.gov" + assert normalize_spaces(page.select(".user-list-item")[6].text) == expected mock_get_users.assert_called_once_with(SERVICE_ONE_ID) diff --git a/tests/app/main/views/test_platform_admin.py b/tests/app/main/views/test_platform_admin.py index b3859024e..568ec2c74 100644 --- a/tests/app/main/views/test_platform_admin.py +++ b/tests/app/main/views/test_platform_admin.py @@ -770,10 +770,10 @@ def test_clear_cache_shows_form( [ call("service-????????-????-????-????-????????????-templates"), call( - "service-????????-????-????-????-????????????-template-????????-????-????-????-????????????-version-*" # noqa + "service-????????-????-????-????-????????????-template-????????-????-????-????-????????????-version-*" # noqa too long ), call( - "service-????????-????-????-????-????????????-template-????????-????-????-????-????????????-versions" # noqa + "service-????????-????-????-????-????????????-template-????????-????-????-????-????????????-versions" # noqa too long ), ], "Removed 6 objects across 3 key formats for template", diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index ac22da76c..b5ce171b4 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -304,7 +304,7 @@ def test_should_show_live_search_if_service_has_lots_of_folders( assert count_of_templates == 4 -@pytest.mark.parametrize( # noqa: PT014 # Requires more research why there are duplicate params here. +@pytest.mark.parametrize( ("service_permissions", "expected_values", "expected_labels"), [ pytest.param( @@ -320,19 +320,20 @@ def test_should_show_live_search_if_service_has_lots_of_folders( "Copy an existing template", ], ), - pytest.param( - ["email", "sms"], - [ - # 'email', - "sms", - "copy-existing", - ], - [ - # 'Email', - "Start with a blank template", - "Copy an existing template", - ], - ), + # TODO This is a duplicate of above. Why? + # pytest.param( + # ["email", "sms"], + # [ + # # 'email', + # "sms", + # "copy-existing", + # ], + # [ + # # 'Email', + # "Start with a blank template", + # "Copy an existing template", + # ], + # ), ], ) def test_should_show_new_template_choices_if_service_has_folder_permission( @@ -753,9 +754,9 @@ def test_choose_a_template_to_copy( assert len(actual) == len(expected) - for actual, expected in zip(actual, expected): # noqa: B020 + zipobject = zip(actual, expected) + for actual, expected in zipobject: assert normalize_spaces(actual.text) == expected - links = page.select("main nav a") assert links[0]["href"] == url_for( "main.choose_template_to_copy", @@ -799,7 +800,8 @@ def test_choose_a_template_to_copy_when_user_has_one_service( assert len(actual) == len(expected) - for actual, expected in zip(actual, expected): # noqa: B020 + zipobject = zip(actual, expected) + for actual, expected in zipobject: assert normalize_spaces(actual.text) == expected assert page.select("main nav a")[0]["href"] == url_for( @@ -875,7 +877,8 @@ def test_choose_a_template_to_copy_from_folder_within_service( assert len(actual) == len(expected) - for actual, expected in zip(actual, expected): # noqa: B020 + zipobject = zip(actual, expected) + for actual, expected in zipobject: assert normalize_spaces(actual.text) == expected links = page.select("main nav a")