Skip to content

Commit f3f8b48

Browse files
fix tests
1 parent 0bc92ea commit f3f8b48

11 files changed

+5
-58
lines changed

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,11 @@ async def test_copying_large_project_and_aborting_correctly_removes_new_project(
9797
standard_groups: list[dict[str, str]],
9898
user_project: dict[str, Any],
9999
expected: ExpectedResponse,
100-
catalog_subsystem_mock: Callable[[list[ProjectDict]], None],
101100
slow_storage_subsystem_mock: MockedStorageSubsystem,
102101
project_db_cleaner: None,
103102
mocked_dynamic_services_interface: dict[str, MagicMock],
104103
):
105104
assert client.app
106-
catalog_subsystem_mock([user_project])
107105
# initiate a project copy that will last long (simulated by a long running storage)
108106
# POST /v0/projects
109107
create_url = client.app.router["create_project"].url_for()
@@ -150,13 +148,11 @@ async def test_copying_large_project_and_retrieving_copy_task(
150148
standard_groups: list[dict[str, str]],
151149
user_project: dict[str, Any],
152150
expected: ExpectedResponse,
153-
catalog_subsystem_mock: Callable[[list[ProjectDict]], None],
154151
slow_storage_subsystem_mock: MockedStorageSubsystem,
155152
project_db_cleaner: None,
156153
mocked_dynamic_services_interface: dict[str, MagicMock],
157154
):
158155
assert client.app
159-
catalog_subsystem_mock([user_project])
160156

161157
# initiate a project copy that will last long (simulated by a long running storage)
162158
# POST /v0/projects
@@ -198,13 +194,11 @@ async def test_creating_new_project_from_template_without_copying_data_creates_s
198194
standard_groups: list[dict[str, str]],
199195
template_project: dict[str, Any],
200196
expected: ExpectedResponse,
201-
catalog_subsystem_mock: Callable[[list[ProjectDict]], None],
202197
slow_storage_subsystem_mock: MockedStorageSubsystem,
203198
project_db_cleaner: None,
204199
request_create_project: Callable[..., Awaitable[ProjectDict]],
205200
):
206201
assert client.app
207-
catalog_subsystem_mock([template_project])
208202
# create a project from another without copying data shall not call in the storage API
209203
# POST /v0/projects
210204
await request_create_project(
@@ -249,13 +243,11 @@ async def test_creating_new_project_as_template_without_copying_data_creates_ske
249243
standard_groups: list[dict[str, str]],
250244
user_project: dict[str, Any],
251245
expected: ExpectedResponse,
252-
catalog_subsystem_mock: Callable[[list[ProjectDict]], None],
253246
slow_storage_subsystem_mock: MockedStorageSubsystem,
254247
project_db_cleaner: None,
255248
request_create_project: Callable[..., Awaitable[ProjectDict]],
256249
):
257250
assert client.app
258-
catalog_subsystem_mock([user_project])
259251
# create a project from another without copying data shall not call in the storage API
260252
# POST /v0/projects
261253
await request_create_project(

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,8 @@ async def test_list_projects(
194194
user_project: dict[str, Any],
195195
template_project: dict[str, Any],
196196
expected: HTTPStatus,
197-
catalog_subsystem_mock: Callable[[list[ProjectDict]], None],
198197
director_v2_service_mock: aioresponses,
199198
):
200-
catalog_subsystem_mock([user_project, template_project])
201199
data, *_ = await _list_and_assert_projects(client, expected)
202200

203201
if data:
@@ -344,7 +342,6 @@ async def test_list_projects_with_innaccessible_services(
344342
user_project: dict[str, Any],
345343
template_project: dict[str, Any],
346344
expected: HTTPStatus,
347-
catalog_subsystem_mock: Callable[[list[ProjectDict]], None],
348345
director_v2_service_mock: aioresponses,
349346
postgres_db: sa.engine.Engine,
350347
s4l_product_headers: dict[str, Any],
@@ -374,7 +371,6 @@ async def test_list_projects_with_innaccessible_services(
374371

375372
# use-case 4: give user access to services
376373
# shall return the projects for any product
377-
catalog_subsystem_mock([user_project, template_project])
378374
data, *_ = await _list_and_assert_projects(
379375
client, expected, headers=s4l_product_headers
380376
)
@@ -403,10 +399,7 @@ async def test_get_project(
403399
user_project: ProjectDict,
404400
template_project: ProjectDict,
405401
expected,
406-
catalog_subsystem_mock: Callable[[list[ProjectDict]], None],
407402
):
408-
catalog_subsystem_mock([user_project, template_project])
409-
410403
# standard project
411404
await _assert_get_same_project(client, user_project, expected)
412405

@@ -444,7 +437,6 @@ async def test_create_get_and_patch_project_ui_field(
444437
logged_user: UserInfoDict,
445438
primary_group: dict[str, str],
446439
request_create_project: Callable[..., Awaitable[ProjectDict]],
447-
catalog_subsystem_mock: Callable[[list[ProjectDict]], None],
448440
project_db_cleaner,
449441
):
450442
assert client.app
@@ -462,8 +454,6 @@ async def test_create_get_and_patch_project_ui_field(
462454
)
463455
project_id = new_project["uuid"]
464456

465-
catalog_subsystem_mock([new_project])
466-
467457
# Step 2: Get the project and check the ui.icon
468458
url = client.app.router["get_project"].url_for(project_id=project_id)
469459
resp = await client.get(f"{url}")
@@ -522,11 +512,9 @@ async def test_new_project_from_other_study(
522512
user_project: ProjectDict,
523513
expected: ExpectedResponse,
524514
storage_subsystem_mock,
525-
catalog_subsystem_mock: Callable[[list[ProjectDict]], None],
526515
project_db_cleaner,
527516
request_create_project: Callable[..., Awaitable[ProjectDict]],
528517
):
529-
catalog_subsystem_mock([user_project])
530518
new_project = await request_create_project(
531519
client,
532520
expected.accepted,
@@ -608,7 +596,6 @@ async def test_new_template_from_project(
608596
user_project: dict[str, Any],
609597
expected: ExpectedResponse,
610598
storage_subsystem_mock: MockedStorageSubsystem,
611-
catalog_subsystem_mock: Callable[[list[ProjectDict]], None],
612599
project_db_cleaner: None,
613600
request_create_project: Callable[..., Awaitable[ProjectDict]],
614601
):
@@ -625,7 +612,6 @@ async def test_new_template_from_project(
625612

626613
if new_template_prj:
627614
template_project = new_template_prj
628-
catalog_subsystem_mock([template_project])
629615

630616
templates, *_ = await _list_and_assert_projects(
631617
client, status.HTTP_200_OK, {"type": "template"}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ async def test_delete_project(
6161
expected: ExpectedResponse,
6262
storage_subsystem_mock: MockedStorageSubsystem,
6363
mocked_dynamic_services_interface: dict[str, MagicMock],
64-
catalog_subsystem_mock: Callable[[list[ProjectDict]], None],
6564
fake_services: Callable[..., Awaitable[list[DynamicServiceGet]]],
6665
assert_get_same_project_caller: Callable,
6766
mock_dynamic_scheduler_rabbitmq: None,

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ async def test_list_projects_with_invalid_pagination_parameters(
133133
primary_group: dict[str, str],
134134
expected: ExpectedResponse,
135135
storage_subsystem_mock,
136-
catalog_subsystem_mock: Callable[[list[ProjectDict]], None],
137136
director_v2_service_mock: aioresponses,
138137
project_db_cleaner,
139138
limit: int,
@@ -158,7 +157,6 @@ async def test_list_projects_with_pagination(
158157
primary_group: dict[str, str],
159158
expected: ExpectedResponse,
160159
storage_subsystem_mock,
161-
catalog_subsystem_mock: Callable[[list[ProjectDict]], None],
162160
director_v2_service_mock: aioresponses,
163161
project_db_cleaner,
164162
limit: int,
@@ -175,7 +173,6 @@ async def test_list_projects_with_pagination(
175173
]
176174
)
177175
if expected.created == status.HTTP_201_CREATED:
178-
catalog_subsystem_mock(created_projects)
179176

180177
assert len(created_projects) == NUM_PROJECTS
181178
NUMBER_OF_CALLS = ceil(NUM_PROJECTS / limit)

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,10 @@ async def test_new_project_with_parent_project_node(
122122
primary_group: dict[str, str],
123123
user_project: ProjectDict,
124124
expected: ExpectedResponse,
125-
catalog_subsystem_mock: Callable[[list[ProjectDict]], None],
126125
request_create_project: Callable[..., Awaitable[ProjectDict]],
127126
aiopg_engine: aiopg.sa.Engine,
128127
):
129128
"""this is new way of setting parents by using request headers"""
130-
catalog_subsystem_mock([user_project])
131129
parent_project = await request_create_project(
132130
client,
133131
expected.accepted,
@@ -199,13 +197,11 @@ async def test_new_project_with_invalid_parent_project_node(
199197
primary_group: dict[str, str],
200198
user_project: ProjectDict,
201199
expected: ExpectedResponse,
202-
catalog_subsystem_mock: Callable[[list[ProjectDict]], None],
203200
request_create_project: Callable[..., Awaitable[ProjectDict]],
204201
aiopg_engine: aiopg.sa.Engine,
205202
faker: Faker,
206203
):
207204
"""this is new way of setting parents by using request headers"""
208-
catalog_subsystem_mock([user_project])
209205
parent_project = await request_create_project(
210206
client,
211207
expected.accepted,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@ async def test_share_project(
277277
expected: ExpectedResponse,
278278
storage_subsystem_mock,
279279
mocked_dynamic_services_interface: dict[str, mock.Mock],
280-
catalog_subsystem_mock: Callable[[list[ProjectDict]], None],
281280
share_rights: dict,
282281
project_db_cleaner,
283282
request_create_project: Callable[..., Awaitable[ProjectDict]],

services/web/server/tests/unit/with_dbs/03/tags/test_tags.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# pylint: disable=too-many-arguments
55

66

7-
from collections.abc import AsyncIterator, Callable, Iterator
7+
from collections.abc import AsyncIterator, Iterator
88
from typing import Any
99

1010
import pytest
@@ -52,9 +52,7 @@ async def test_tags_to_studies(
5252
client: TestClient,
5353
faker: Faker,
5454
user_project: ProjectDict,
55-
catalog_subsystem_mock: Callable[[list[ProjectDict]], None],
5655
):
57-
catalog_subsystem_mock([user_project])
5856
assert client.app
5957

6058
# Add test tags

services/web/server/tests/unit/with_dbs/03/trash/conftest.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
import logging
10-
from collections.abc import AsyncIterable, Callable
10+
from collections.abc import AsyncIterable
1111
from pathlib import Path
1212

1313
import pytest
@@ -72,19 +72,15 @@ async def other_user_project(
7272
@pytest.fixture
7373
def mocked_catalog(
7474
user_project: ProjectDict,
75-
catalog_subsystem_mock: Callable[[list[ProjectDict]], None],
76-
):
77-
catalog_subsystem_mock([user_project])
75+
): ...
7876

7977

8078
@pytest.fixture
81-
def mocked_director_v2(director_v2_service_mock: aioresponses):
82-
...
79+
def mocked_director_v2(director_v2_service_mock: aioresponses): ...
8380

8481

8582
@pytest.fixture
86-
def mocked_storage(storage_subsystem_mock: MockedStorageSubsystem):
87-
...
83+
def mocked_storage(storage_subsystem_mock: MockedStorageSubsystem): ...
8884

8985

9086
@pytest.fixture

services/web/server/tests/unit/with_dbs/03/trash/test_trash_rest.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,6 @@ async def test_trash_workspace(
587587
workspace: WorkspaceGet,
588588
user_project: ProjectDict,
589589
fake_project: ProjectDict,
590-
mocked_catalog: None,
591590
mocked_dynamic_services_interface: dict[str, MagicMock],
592591
postgres_db: sa.engine.Engine,
593592
):
@@ -843,7 +842,6 @@ async def test_trash_subfolder(
843842
client: TestClient,
844843
logged_user: UserInfoDict,
845844
user_project: ProjectDict,
846-
mocked_catalog: None,
847845
mocked_dynamic_services_interface: dict[str, MagicMock],
848846
):
849847
assert client.app
@@ -941,7 +939,6 @@ async def test_trash_project_in_subfolder(
941939
client: TestClient,
942940
logged_user: UserInfoDict,
943941
user_project: ProjectDict,
944-
mocked_catalog: None,
945942
mocked_dynamic_services_interface: dict[str, MagicMock],
946943
):
947944
assert client.app
@@ -1030,7 +1027,6 @@ async def test_trash_project_explitictly_and_empty_trash_bin(
10301027
client: TestClient,
10311028
logged_user: UserInfoDict,
10321029
user_project: ProjectDict,
1033-
mocked_catalog: None,
10341030
mocked_director_v2: None,
10351031
mocked_dynamic_services_interface: dict[str, MagicMock],
10361032
mocked_storage: None,
@@ -1088,7 +1084,6 @@ async def test_trash_folder_with_subfolder_and_project_and_empty_bin(
10881084
client: TestClient,
10891085
logged_user: UserInfoDict,
10901086
user_project: ProjectDict,
1091-
mocked_catalog: None,
10921087
mocked_director_v2: None,
10931088
mocked_dynamic_services_interface: dict[str, MagicMock],
10941089
mocked_storage: None,

services/web/server/tests/unit/with_dbs/04/studies_dispatcher/test_studies_dispatcher_handlers.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,6 @@ async def test_dispatch_study_anonymously(
390390
redirect_type: str,
391391
mocker: MockerFixture,
392392
storage_subsystem_mock,
393-
catalog_subsystem_mock: None,
394393
mocks_on_projects_api,
395394
):
396395
assert client.app
@@ -456,7 +455,6 @@ async def test_dispatch_logged_in_user(
456455
mocker: MockerFixture,
457456
mock_dynamic_scheduler: None,
458457
storage_subsystem_mock,
459-
catalog_subsystem_mock: None,
460458
mocks_on_projects_api: None,
461459
):
462460
assert client.app

0 commit comments

Comments
 (0)