Esempio n. 1
0
 def test_constructor(self):
     color = PlayerColor.BLUE
     card = CardType.CARD_APOLOGIES
     history = History("action", color, card)
     assert history.action == "action"
     assert history.color is color
     assert history.card is card
     assert history.timestamp <= DateTime.utcnow()
Esempio n. 2
0
 def test_track_no_player(self):
     game = Game(4)
     game.track("action")
     assert game.history[0].action == "action"
     assert game.history[0].color is None
     assert game.history[0].card is None
     assert game.history[0].timestamp <= DateTime.utcnow()
     assert game.players[PlayerColor.RED].turns == 0
     assert game.players[PlayerColor.YELLOW].turns == 0
     assert game.players[PlayerColor.BLUE].turns == 0
     assert game.players[PlayerColor.GREEN].turns == 0
Esempio n. 3
0
 def test_track_with_color(self):
     game = Game(4)
     player = MagicMock(color=PlayerColor.RED)
     card = MagicMock(cardtype=CardType.CARD_12)
     game.track("action", player, card)
     assert game.history[0].action == "action"
     assert game.history[0].color is PlayerColor.RED
     assert game.history[0].card == CardType.CARD_12
     assert game.history[0].timestamp <= DateTime.utcnow()
     assert game.players[PlayerColor.RED].turns == 1
     assert game.players[PlayerColor.YELLOW].turns == 0
     assert game.players[PlayerColor.BLUE].turns == 0
     assert game.players[PlayerColor.GREEN].turns == 0