Skip to content

Commit edeef39

Browse files
committed
feature/tests/strenghten_verifications
1 parent adcf46a commit edeef39

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

tests/integration/test_rooms_api.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ def test_list_rooms_returns_all(self, client, db_session):
5353

5454
response = client.get("/rooms/")
5555
assert response.status_code == status.HTTP_200_OK
56-
assert len(response.json()) == 2
56+
body = response.json()
57+
assert len(body) == 2
58+
names = {r["name"] for r in body}
59+
assert "101" in names
60+
assert "102" in names
5761

5862
def test_list_rooms_paginated(self, client, db_session):
5963
from api.schemas.room import RoomCreate
@@ -76,6 +80,7 @@ def test_list_rooms_paginated(self, client, db_session):
7680
assert response.status_code == status.HTTP_200_OK
7781
body = response.json()
7882
assert len(body) == 1
83+
assert body[0]["name"] == "102"
7984

8085

8186
class TestUpdateRoom:

tests/unit/services/test_room_service.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def test_list_rooms_basic(self, db_session):
7474
)
7575
result = RoomService.get_multi(db_session)
7676
assert len(result) == 2
77+
assert {r.name for r in result} == {"101", "102"}
7778

7879
def test_list_rooms_excludes_inactive(self, db_session, room):
7980
RoomService.delete(db_session, room.id)
@@ -136,6 +137,9 @@ def test_delete_room_with_active_reservations(self, db_session, reservation):
136137
assert exc.value.status_code == 409
137138
assert exc.value.detail == "cannot delete room with active reservations"
138139

140+
still_exists = RoomService.get(db_session, room_id)
141+
assert still_exists.id == room_id
142+
139143

140144
class TestSeedRoom:
141145
def test_seed_creates_requested_rooms(self, db_session):

tests/unit/services/test_user_service.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ def test_delete_user_with_active_reservations(self, db_session, reservation):
131131
assert exc.value.status_code == 409
132132
assert exc.value.detail == "cannot delete user with active reservations"
133133

134+
still_exists = UserService.get(db_session, user_id)
135+
assert still_exists.id == user_id
136+
134137

135138
class TestSeedUser:
136139
def test_seed_creates_requested_users(self, db_session):

0 commit comments

Comments
 (0)