Skip to content

Commit 9a34351

Browse files
committed
fixing tests
1 parent 3255e69 commit 9a34351

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

services/web/server/tests/unit/with_dbs/03/test_users_rest_profile.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def app_environment(
5151

5252

5353
@pytest.fixture
54-
async def support_group(
54+
async def support_group_before_app_starts(
5555
asyncpg_engine: AsyncEngine,
5656
product_name: str,
5757
) -> AsyncIterator[dict[str, Any]]:
@@ -135,13 +135,14 @@ async def test_access_update_profile(
135135

136136
@pytest.mark.parametrize("user_role", [UserRole.USER])
137137
async def test_get_profile_user_not_in_support_group(
138+
support_group_before_app_starts: dict[str, Any],
139+
# after app starts because it modifies the product
138140
user_role: UserRole,
139141
logged_user: UserInfoDict,
140142
client: TestClient,
141143
primary_group: dict[str, Any],
142144
standard_groups: list[dict[str, Any]],
143145
all_group: dict[str, str],
144-
support_group: dict[str, Any],
145146
):
146147
assert client.app
147148

@@ -176,8 +177,11 @@ async def test_get_profile_user_not_in_support_group(
176177
assert got_profile_groups["support"]
177178
support_group_id = got_profile_groups["support"]["gid"]
178179

179-
assert support_group_id == support_group["gid"]
180-
assert got_profile_groups["support"]["description"] == support_group["description"]
180+
assert support_group_id == support_group_before_app_starts["gid"]
181+
assert (
182+
got_profile_groups["support"]["description"]
183+
== support_group_before_app_starts["description"]
184+
)
181185
assert "accessRights" not in got_profile_groups["support"]
182186

183187
# standard groups with at least read access
@@ -196,24 +200,24 @@ async def test_get_profile_user_not_in_support_group(
196200
)
197201

198202

199-
@pytest.mark.test
200203
@pytest.mark.parametrize("user_role", [UserRole.USER])
201204
async def test_get_profile_user_in_support_group(
205+
support_group_before_app_starts: dict[str, Any],
206+
# after app starts because it modifies the product
202207
user_role: UserRole,
203208
logged_user: UserInfoDict,
204209
client: TestClient,
205210
primary_group: dict[str, Any],
206211
standard_groups: list[dict[str, Any]],
207212
all_group: dict[str, str],
208-
support_group: dict[str, Any],
209213
):
210214
assert client.app
211215
from simcore_service_webserver.groups import _groups_repository
212216

213217
# Now add user to support group with read-only access
214218
await _groups_repository.add_new_user_in_group(
215219
client.app,
216-
group_id=support_group["gid"],
220+
group_id=support_group_before_app_starts["gid"],
217221
new_user_id=logged_user["id"],
218222
access_rights=AccessRightsDict(read=True, write=False, delete=False),
219223
)
@@ -249,8 +253,11 @@ async def test_get_profile_user_in_support_group(
249253
assert got_profile_groups["support"]
250254
support_group_id = got_profile_groups["support"]["gid"]
251255

252-
assert support_group_id == support_group["gid"]
253-
assert got_profile_groups["support"]["description"] == support_group["description"]
256+
assert support_group_id == support_group_before_app_starts["gid"]
257+
assert (
258+
got_profile_groups["support"]["description"]
259+
== support_group_before_app_starts["description"]
260+
)
254261
assert "accessRights" not in got_profile_groups["support"]
255262

256263
# When user is part of support group, it should appear in standard groups
@@ -259,8 +266,8 @@ async def test_get_profile_user_in_support_group(
259266
*standard_groups,
260267
{
261268
"gid": support_group_id,
262-
"label": support_group["name"],
263-
"description": support_group["description"],
269+
"label": support_group_before_app_starts["name"],
270+
"description": support_group_before_app_starts["description"],
264271
"thumbnail": None,
265272
"accessRights": {"read": True, "write": False, "delete": False},
266273
},

0 commit comments

Comments
 (0)