Skip to content

Commit 51362fe

Browse files
committed
refactor
1 parent 9d2ef08 commit 51362fe

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

services/web/server/tests/unit/with_dbs/02/test_projects_states_handlers.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
from pytest_simcore.helpers.webserver_parametrizations import (
5757
ExpectedResponse,
5858
standard_role_response,
59+
standard_user_role_response,
5960
)
6061
from pytest_simcore.helpers.webserver_projects import assert_get_same_project
6162
from pytest_simcore.helpers.webserver_users import UserInfoDict
@@ -569,8 +570,6 @@ async def test_open_template_project_for_edition(
569570
@pytest.mark.parametrize(
570571
"user_role,expected",
571572
[
572-
(UserRole.ANONYMOUS, status.HTTP_401_UNAUTHORIZED),
573-
(UserRole.GUEST, status.HTTP_403_FORBIDDEN),
574573
(UserRole.USER, status.HTTP_403_FORBIDDEN),
575574
(UserRole.TESTER, status.HTTP_403_FORBIDDEN),
576575
],
@@ -600,13 +599,7 @@ async def test_open_template_project_for_edition_with_missing_write_rights(
600599
await assert_status(resp, expected)
601600

602601

603-
def standard_user_role() -> tuple[str, tuple]:
604-
all_roles = standard_role_response()
605-
606-
return (all_roles[0], (pytest.param(*all_roles[1][2], id="standard user role"),))
607-
608-
609-
@pytest.mark.parametrize(*standard_user_role())
602+
@pytest.mark.parametrize(*standard_user_role_response())
610603
async def test_open_project_with_small_amount_of_dynamic_services_starts_them_automatically(
611604
client: TestClient,
612605
logged_user: UserInfoDict,
@@ -652,7 +645,7 @@ async def test_open_project_with_small_amount_of_dynamic_services_starts_them_au
652645
].reset_mock()
653646

654647

655-
@pytest.mark.parametrize(*standard_user_role())
648+
@pytest.mark.parametrize(*standard_user_role_response())
656649
async def test_open_project_with_disable_service_auto_start_set_overrides_behavior(
657650
client: TestClient,
658651
logged_user: UserInfoDict,
@@ -696,7 +689,7 @@ async def test_open_project_with_disable_service_auto_start_set_overrides_behavi
696689
].assert_not_called()
697690

698691

699-
@pytest.mark.parametrize(*standard_user_role())
692+
@pytest.mark.parametrize(*standard_user_role_response())
700693
async def test_open_project_with_large_amount_of_dynamic_services_does_not_start_them_automatically(
701694
client: TestClient,
702695
logged_user: UserInfoDict,
@@ -741,7 +734,7 @@ async def test_open_project_with_large_amount_of_dynamic_services_does_not_start
741734
].assert_not_called()
742735

743736

744-
@pytest.mark.parametrize(*standard_user_role())
737+
@pytest.mark.parametrize(*standard_user_role_response())
745738
async def test_open_project_with_large_amount_of_dynamic_services_starts_them_if_setting_disabled(
746739
mock_get_total_project_dynamic_nodes_creation_interval: None,
747740
disable_max_number_of_running_dynamic_nodes: dict[str, str],
@@ -791,7 +784,7 @@ async def test_open_project_with_large_amount_of_dynamic_services_starts_them_if
791784
].assert_called()
792785

793786

794-
@pytest.mark.parametrize(*standard_user_role())
787+
@pytest.mark.parametrize(*standard_user_role_response())
795788
async def test_open_project_with_deprecated_services_ok_but_does_not_start_dynamic_services(
796789
client: TestClient,
797790
logged_user,
@@ -843,7 +836,7 @@ def one_max_open_studies_per_user(
843836
)
844837

845838

846-
@pytest.mark.parametrize(*standard_role_response())
839+
@pytest.mark.parametrize(*standard_user_role_response())
847840
async def test_open_project_more_than_limitation_of_max_studies_open_per_user(
848841
one_max_open_studies_per_user: None,
849842
client: TestClient,
@@ -1264,7 +1257,7 @@ def clean_redis_table(redis_client) -> None:
12641257
"""this just ensures the redis table is cleaned up between test runs"""
12651258

12661259

1267-
@pytest.mark.parametrize(*standard_role_response())
1260+
@pytest.mark.parametrize(*standard_user_role_response())
12681261
async def test_open_shared_project_2_users_locked(
12691262
client: TestClient,
12701263
client_on_running_server_factory: Callable[[], TestClient],
@@ -1465,7 +1458,7 @@ async def test_open_shared_project_2_users_locked(
14651458
)
14661459

14671460

1468-
@pytest.mark.parametrize(*standard_role_response())
1461+
@pytest.mark.parametrize(*standard_user_role_response())
14691462
async def test_open_shared_project_at_same_time(
14701463
client: TestClient,
14711464
client_on_running_server_factory: Callable[[], TestClient],
@@ -1558,7 +1551,7 @@ async def test_open_shared_project_at_same_time(
15581551
assert num_assertions == NUMBER_OF_ADDITIONAL_CLIENTS
15591552

15601553

1561-
@pytest.mark.parametrize(*standard_role_response())
1554+
@pytest.mark.parametrize(*standard_user_role_response())
15621555
async def test_opened_project_can_still_be_opened_after_refreshing_tab(
15631556
client: TestClient,
15641557
logged_user: dict[str, Any],

0 commit comments

Comments
 (0)