Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UPDATE: use list of player instead of number in list #348

Merged
merged 4 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/whist_server/api/room/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_get_all_ids_require_login(self):
def test_get_room_info(self):
expected_info = RoomInfo(name='test', password=True, rubber_number=0,
game_number=0, hand_number=0, trick_number=0, min_player=2,
max_player=2, player_number=1)
max_player=2, players=[self.player_mock])
self.room_mock.get_info = MagicMock(return_value=expected_info)
self.room_service_mock.get = MagicMock(return_value=self.room_mock)
response = self.client.get(f'/room/info/{self.room_mock.id}')
Expand Down
4 changes: 2 additions & 2 deletions tests/whist_server/database/test_room.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ def test_room_info(self):
room_info = self.room.get_info()
expected_info = RoomInfo(name='test', password=True, rubber_number=0,
game_number=0, hand_number=0, trick_number=0, min_player=2,
max_player=2, player_number=1)
max_player=2, players=[self.player])
self.assertEqual(expected_info, room_info)

def test_room_info_no_pwd(self):
self.room.hashed_password = None
room_info = self.room.get_info()
expected_info = RoomInfo(name='test', password=False, rubber_number=0,
game_number=0, hand_number=0, trick_number=0, min_player=2,
max_player=2, player_number=1)
max_player=2, players=[self.player])
self.assertEqual(expected_info, room_info)
4 changes: 2 additions & 2 deletions whist_server/database/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class RoomInfo(BaseModel):
trick_number: int
min_player: int
max_player: int
player_number: int
players: list[Player]

@staticmethod
def from_room(room: RoomInDb) -> 'RoomInfo':
Expand All @@ -212,4 +212,4 @@ def from_room(room: RoomInDb) -> 'RoomInfo':
trick_number=trick_number,
min_player=room.table.min_player,
max_player=room.table.max_player,
player_number=len(room.table.users))
players=room.table.users.players)