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
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
def _create_realistic_game(): """Create a realistic game with changes to the defaults for all types of values.""" game = Game(4) game.track("this happened") game.track("another thing", game.players[PlayerColor.RED]) card1 = game.deck.draw() card2 = game.deck.draw() game.deck.draw() # just throw it away game.deck.discard(card1) game.deck.discard(card2) game.players[PlayerColor.RED].pawns[0].position.move_to_square(32) game.players[PlayerColor.BLUE].pawns[2].position.move_to_home() game.players[PlayerColor.BLUE].hand.append(card1) game.players[PlayerColor.YELLOW].pawns[3].position.move_to_safe(1) game.players[PlayerColor.GREEN].pawns[1].position.move_to_square(19) game.players[PlayerColor.GREEN].hand.append(card2) return game
def test_started(self): game = Game(4) assert game.started is False game.track("whatever") assert game.started is True