Skip to content

Commit d0ace93

Browse files
committed
fix tests
1 parent bdc2761 commit d0ace93

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

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

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
# pylint: disable=unused-variable
44
# pylint: disable=too-many-arguments
55

6-
from collections.abc import Awaitable, Callable
7-
from typing import Any
86
from uuid import UUID
97

108
import pytest
119
from aiohttp.test_utils import TestClient
10+
from common_library.users_enums import UserRole
1211
from pytest_simcore.helpers.webserver_login import UserInfoDict
1312
from simcore_service_webserver.projects import (
1413
_projects_db as projects_service_repository,
@@ -17,28 +16,28 @@
1716
from simcore_service_webserver.projects.models import ProjectDict
1817

1918

19+
@pytest.fixture
20+
def user_role() -> UserRole:
21+
return UserRole.USER
22+
23+
2024
async def test_get_project(
2125
client: TestClient,
2226
logged_user: UserInfoDict,
2327
user_project: ProjectDict,
24-
insert_project_in_db: Callable[..., Awaitable[dict[str, Any]]],
2528
):
2629
assert client.app
2730

28-
# Insert a project into the database
29-
new_project = await insert_project_in_db(user_project, user_id=logged_user["id"])
30-
31-
# Retrieve the project using the repository function
32-
retrieved_project = await projects_service_repository.get_project(
33-
client.app, project_uuid=UUID(new_project["uuid"])
31+
# Get valid project
32+
got = await projects_service_repository.get_project(
33+
client.app, project_uuid=user_project["uuid"]
3434
)
3535

36-
# Validate the retrieved project
37-
assert retrieved_project.uuid == new_project["uuid"]
38-
assert retrieved_project.name == new_project["name"]
39-
assert retrieved_project.description == new_project["description"]
36+
assert got.uuid == UUID(user_project["uuid"])
37+
assert got.name == user_project["name"]
38+
assert got.description == user_project["description"]
4039

41-
# Test retrieving a non-existent project
40+
# Get non-existent project
4241
non_existent_project_uuid = UUID("00000000-0000-0000-0000-000000000000")
4342
with pytest.raises(ProjectNotFoundError):
4443
await projects_service_repository.get_project(

0 commit comments

Comments
 (0)