Skip to content

Commit 953000c

Browse files
committed
testing
1 parent 154ed9b commit 953000c

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

services/web/server/src/simcore_service_webserver/projects/_jobs_service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from models_library.projects import ProjectID
77
from models_library.users import UserID
88
from pydantic import AfterValidator, validate_call
9-
from simcore_service_webserver.projects.models import ProjectDBGet
9+
from simcore_service_webserver.projects.models import ProjectJobDBGet
1010

1111
from ._access_rights_service import check_user_project_permission
1212
from ._jobs_repository import ProjectJobsRepository
@@ -57,7 +57,7 @@ async def list_my_projects_marked_as_jobs(
5757
offset: int = 0,
5858
limit: int = 10,
5959
job_parent_resource_name_filter: str | None = None,
60-
) -> tuple[int, list[ProjectDBGet]]:
60+
) -> tuple[int, list[ProjectJobDBGet]]:
6161
"""
6262
Lists paginated projects marked as jobs for the given user and product.
6363
Optionally filters by job_parent_resource_name using SQL-like wildcard patterns.

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

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,26 @@
1111
async def test_list_my_projects_marked_as_jobs_empty(
1212
client: TestClient,
1313
logged_user: UserInfoDict, # owns `user_project`
14-
osparc_product_name: ProductName,
1514
user_project: ProjectDict,
15+
osparc_product_name: ProductName,
1616
):
1717
assert client.app
1818
assert user_project
1919

20-
result = await list_my_projects_marked_as_jobs(
20+
total_count, result = await list_my_projects_marked_as_jobs(
2121
app=client.app,
2222
product_name=osparc_product_name,
2323
user_id=logged_user["id"],
2424
)
25+
assert total_count == 0
2526
assert result == []
2627

2728

2829
async def test_list_my_projects_marked_as_jobs_with_one_marked(
2930
client: TestClient,
3031
logged_user: UserInfoDict, # owns `user_project`
31-
osparc_product_name: ProductName,
3232
user_project: ProjectDict,
33+
osparc_product_name: ProductName,
3334
):
3435
assert client.app
3536

@@ -45,35 +46,49 @@ async def test_list_my_projects_marked_as_jobs_with_one_marked(
4546
job_parent_resource_name=job_parent_resource_name,
4647
)
4748

48-
result = await list_my_projects_marked_as_jobs(
49+
total_count, result = await list_my_projects_marked_as_jobs(
4950
app=client.app,
5051
product_name=osparc_product_name,
5152
user_id=user_id,
5253
)
54+
assert total_count == 1
5355
assert len(result) == 1
54-
assert result[0]["project_uuid"] == project_uuid
55-
assert result[0]["job_parent_resource_name"] == job_parent_resource_name
5656

57-
result = await list_my_projects_marked_as_jobs(
57+
project = result[0]
58+
assert project.uuid == project_uuid
59+
assert project.job_parent_resource_name == job_parent_resource_name
60+
61+
total_count, result = await list_my_projects_marked_as_jobs(
5862
app=client.app,
5963
product_name=osparc_product_name,
6064
user_id=user_id,
6165
job_parent_resource_name_filter=job_parent_resource_name,
6266
)
67+
assert total_count == 1
6368
assert len(result) == 1
6469

65-
result = await list_my_projects_marked_as_jobs(
70+
project = result[0]
71+
assert project.uuid == project_uuid
72+
assert project.job_parent_resource_name == job_parent_resource_name
73+
74+
total_count, result = await list_my_projects_marked_as_jobs(
6675
app=client.app,
6776
product_name=osparc_product_name,
6877
user_id=user_id,
6978
job_parent_resource_name_filter="test/%",
7079
)
80+
assert total_count == 1
7181
assert len(result) == 1
7282

73-
result = await list_my_projects_marked_as_jobs(
83+
project = result[0]
84+
assert project.project_uuid == project_uuid
85+
assert project.job_parent_resource_name == job_parent_resource_name
86+
87+
total_count, result = await list_my_projects_marked_as_jobs(
7488
app=client.app,
7589
product_name=osparc_product_name,
7690
user_id=user_id,
7791
job_parent_resource_name_filter="other/%",
7892
)
93+
assert total_count == 0
7994
assert len(result) == 0

0 commit comments

Comments
 (0)