From 222a119a2100bfd7e703718423d1161f40b3b62d Mon Sep 17 00:00:00 2001 From: Thomas Rubini <74205383+ThomasRubini@users.noreply.github.com> Date: Thu, 5 Jan 2023 15:38:24 +0100 Subject: [PATCH] fix test that game cannot be started twice --- tests/test_api.py | 1 + truthseeker/logic/game_logic.py | 2 +- truthseeker/routes/routes_api.py | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_api.py b/tests/test_api.py index fe47ab8..4235864 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -205,6 +205,7 @@ def test_that_people_can_start_a_game(): def test_that_a_started_game_cannot_be_started_again(): owner = User("neosteopathie") game_id = createGame(owner) + startGame(owner) with pytest.raises(TestException) as e: startGame(owner) diff --git a/truthseeker/logic/game_logic.py b/truthseeker/logic/game_logic.py index c443bf3..b46f2f4 100644 --- a/truthseeker/logic/game_logic.py +++ b/truthseeker/logic/game_logic.py @@ -50,7 +50,7 @@ class Game: self.game_id = None self.owner = None self.members = [] - self.has_started = True + self.has_started = False def set_owner(self, username): self.owner = Member(username) diff --git a/truthseeker/routes/routes_api.py b/truthseeker/routes/routes_api.py index 5a1f3ee..c18b6e1 100644 --- a/truthseeker/routes/routes_api.py +++ b/truthseeker/routes/routes_api.py @@ -59,10 +59,11 @@ def start_game(): if game == None: return {"error": 1, "msg": "this game doesn't exist"} + print(game.has_started) if game.has_started: return {"error": 1, "msg": "this game is already started"} - game.has_started = None + game.has_started = True