Skip to content

Commit cada5a1

Browse files
committed
tests calls deletion but still fail because fixtures mocks missing
1 parent 4e0810c commit cada5a1

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
ProjectNotTrashedError,
2323
ProjectRunningConflictError,
2424
)
25-
from .models import ProjectPatchInternalExtended
25+
from .models import ProjectDict, ProjectPatchInternalExtended
2626

2727
_logger = logging.getLogger(__name__)
2828

@@ -128,6 +128,13 @@ async def untrash_project(
128128
)
129129

130130

131+
def _get_trashed_fields(project: ProjectDict):
132+
trashed_at = project.get("trashed")
133+
trashed_by = project.get("trashedBy")
134+
trashed_explicitly = project.get("trashedExplicitly")
135+
return trashed_at, trashed_by, trashed_explicitly
136+
137+
131138
async def list_trashed_projects(
132139
app: web.Application,
133140
*,
@@ -155,9 +162,7 @@ async def list_trashed_projects(
155162
# by defining a custom trash_filter that permits some flexibility in the filtering options
156163
trashed_projects = []
157164
for project in projects:
158-
trashed_at = project.get("trashed_at")
159-
trashed_by = project.get("trashed_by")
160-
trashed_explicitly = project.get("trashed_explicitly")
165+
trashed_at, trashed_by, trashed_explicitly = _get_trashed_fields(project)
161166

162167
if (
163168
trashed_at
@@ -191,9 +196,7 @@ async def delete_trashed_project(
191196
if not project:
192197
raise ProjectNotFoundError(project_uuid=project_id, user_id=user_id)
193198

194-
trashed_at = project.get("trashed_at")
195-
trashed_by = project.get("trashed_by")
196-
trashed_explicitly = project.get("trashed_explicitly")
199+
trashed_at, trashed_by, trashed_explicitly = _get_trashed_fields(project)
197200

198201
if (
199202
not trashed_at

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,7 @@ async def test_trash_project_explitictly_and_empty_trash_bin(
797797
logged_user: UserInfoDict,
798798
user_project: ProjectDict,
799799
mocked_catalog: None,
800+
mocked_director_v2: None,
800801
mocked_dynamic_services_interface: dict[str, MagicMock],
801802
):
802803
assert client.app

0 commit comments

Comments
 (0)