Example #1
0
 def test_player_buy_card(self):
     """
     Tests the buy_card method. This method only checks whether the attack
     action works properly.Any validation checks are conducted in parent
     methods and are thus checked using alternative test cases.
     """
     player = Player('Nikos')
     player._money = 10
     central = {
         'deck': CardsCollection(),
         'active': CardsCollection(),
         'supplement': CardsCollection(),
         'active_size': 5
     }
     central['deck'].push(Card('Deck card', 3, 0, 2), 1)
     central['active'].push(Card('Archer', 3, 0, 2), 5)
     player.buy_card(central['active'], central['deck'], 0)
     self.assertEqual(central['active'].size(), 5)
     self.assertEqual(player.discard.size(), 1)
     self.assertEqual(player.discard.cards[0].name, 'Archer')
     self.assertEqual(central['active'].cards[4].name, 'Deck card')
     player.buy_card(central['active'], central['deck'], 0)
     # deck size = 0 now -> no more cards from deck to active area
     self.assertEqual(central['active'].size(), 4)
     self.assertEqual(player.discard.size(), 2)
Example #2
0
 def test_player_buy_supplement(self):
     """
     Tests the buy_supplement method. This method only checks whether the attack
     action works properly.Any validation checks are conducted in parent
     methods and are thus checked using alternative test cases.
     """
     player = Player('Nikos')
     player._money = 2
     central = {
         'deck': CardsCollection(),
         'active': CardsCollection(),
         'supplement': CardsCollection(),
         'active_size': 5
     }
     central['supplement'].push(Card('Levy', 1, 2, 2), 10)
     player.buy_supplement(central['supplement'])
     self.assertEqual(central['supplement'].size(), 9)
     self.assertEqual(player.discard.size(), 1)
     self.assertEqual(player.money, 0)