def test_game_ready_time_delay(self): game = GameFactory() game.players.append(PlayerFactory(id='U1')) game.players.append(PlayerFactory(id='U2')) game.players.append(PlayerFactory(id='U3')) game.players.append(PlayerFactory(id='U4')) with freeze_time("2000-01-01 12:00:00"): game.start_turn() game.players[1].played_card = Card.query.get(11) game.players[2].played_card = Card.query.get(12) with self.assertRaises(errors.TooEarly): game.check_turn_ready() with freeze_time("2000-01-01 12:01:01"): self.assertTrue(game.check_turn_ready())
def test_game_ready_players_played(self): game = GameFactory() game.players.append(PlayerFactory(id='U1')) game.players.append(PlayerFactory(id='U2')) game.players.append(PlayerFactory(id='U3')) game.players.append(PlayerFactory(id='U4')) game.start_turn() game.players[1].played_card = Card.query.get(11) with self.assertRaises(errors.NotEnoughPlayers): game.check_turn_ready() game.players[2].played_card = Card.query.get(12) with self.assertRaises(errors.TooEarly): game.check_turn_ready() game.players[3].played_card = Card.query.get(13) self.assertTrue(game.check_turn_ready())