fix test that game cannot be started twice
This commit is contained in:
parent
2f29aa48bc
commit
222a119a21
@ -205,6 +205,7 @@ def test_that_people_can_start_a_game():
|
|||||||
def test_that_a_started_game_cannot_be_started_again():
|
def test_that_a_started_game_cannot_be_started_again():
|
||||||
owner = User("neosteopathie")
|
owner = User("neosteopathie")
|
||||||
game_id = createGame(owner)
|
game_id = createGame(owner)
|
||||||
|
startGame(owner)
|
||||||
with pytest.raises(TestException) as e:
|
with pytest.raises(TestException) as e:
|
||||||
startGame(owner)
|
startGame(owner)
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class Game:
|
|||||||
self.game_id = None
|
self.game_id = None
|
||||||
self.owner = None
|
self.owner = None
|
||||||
self.members = []
|
self.members = []
|
||||||
self.has_started = True
|
self.has_started = False
|
||||||
|
|
||||||
def set_owner(self, username):
|
def set_owner(self, username):
|
||||||
self.owner = Member(username)
|
self.owner = Member(username)
|
||||||
|
@ -59,10 +59,11 @@ def start_game():
|
|||||||
|
|
||||||
if game == None:
|
if game == None:
|
||||||
return {"error": 1, "msg": "this game doesn't exist"}
|
return {"error": 1, "msg": "this game doesn't exist"}
|
||||||
|
print(game.has_started)
|
||||||
if game.has_started:
|
if game.has_started:
|
||||||
return {"error": 1, "msg": "this game is already started"}
|
return {"error": 1, "msg": "this game is already started"}
|
||||||
|
|
||||||
game.has_started = None
|
game.has_started = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user