Skip to content

Commit 002e0a7

Browse files
committed
Fix project tests
1 parent 6be325b commit 002e0a7

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

backend/tests/test_project_operations.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,15 @@ def test_list_project(self, faker: Faker) -> None:
145145
)
146146
created_projects_without_user.append(created_project)
147147

148-
assert len(self.project_manager.list_projects()) == len(
149-
created_projects_without_user
148+
# when running the test against an endpoint, list_projects might also return the project belonging to the user which is a technical project
149+
projects = list(
150+
filter(
151+
lambda project: not project.technical_project,
152+
self.project_manager.list_projects(),
153+
)
150154
)
155+
assert len(projects) == len(created_projects_without_user)
156+
151157

152158
# Set an authorized user in the request state
153159
username = faker.simple_profile()["username"]
@@ -223,7 +229,14 @@ def test_delete_project(self, faker: Faker) -> None:
223229
with pytest.raises(ResourceNotFoundError):
224230
self.project_manager.get_project(created_project.id)
225231

226-
assert len(self.project_manager.list_projects()) == 0
232+
# when running the test against an endpoint, list_projects might also return the project belonging to the user which is a technical project
233+
projects = list(
234+
filter(
235+
lambda project: not project.technical_project,
236+
self.project_manager.list_projects(),
237+
)
238+
)
239+
assert len(projects) == 0
227240

228241
def test_project_member_handling(self, faker: Faker) -> None:
229242
project_name = faker.bs()

0 commit comments

Comments
 (0)