Add a card_name parameter
[naja.git] / naja / tests / test_gameboard.py
index 2db02a78b436d8bdf72dabb9c5f888e0fd547285..5b383991273e9d20f919a54cfec4104913ffcbae 100644 (file)
@@ -12,7 +12,7 @@ class TestGameBoard(TestCase):
 
     def make_deck(self, cards=None):
         if cards is None:
-            cards = [{'actions': []}]
+            cards = [{'card_name': 'card', 'actions': []}]
         return {'cards': cards}
 
     def assert_state(self, state1, state2, exclude=(), player_exclude=()):
@@ -30,7 +30,8 @@ class TestGameBoard(TestCase):
         self.assertEqual(state1, state2)
 
     def test_export_new_board(self):
-        board = GameBoard.new_game({'cards': [{'actions': [
+        board = GameBoard.new_game({'cards': [
+            {'card_name' : 'card1', 'actions': [
             {
                 'action_class': 'LoseHealthOrMSB',
                 'required_bits': [],
@@ -46,7 +47,7 @@ class TestGameBoard(TestCase):
             'health': 4,
             'wins_required': 4,
             'wins': 0,
-            'locations': [{'actions': [
+            'locations': [{'card_name' : 'card1', 'actions': [
                 {
                     'action_class': 'LoseHealthOrMSB',
                     'required_bits': [],
@@ -63,7 +64,8 @@ class TestGameBoard(TestCase):
         for position, location_state in board_locations:
             positions.append(position)
             self.assertEqual(
-                sorted(location_state.keys()), ['actions', 'bitwise_operand'])
+                sorted(location_state.keys()), ['actions', 'bitwise_operand',
+                                                'card_name'])
             self.assertEqual(location_state['actions'], [
                 {
                     'action_class': 'LoseHealthOrMSB',
@@ -244,14 +246,15 @@ class TestLocationCard(TestCase):
         self.assertEqual(bits, set(BITS.values()))
 
     def test_new_location_no_actions(self):
-        location = LocationCard.new_location({'actions': []})
+        location = LocationCard.new_location({'card_name': 'card',
+                                              'actions': []})
         [action] = location.actions
         self.assertEqual(type(action), actions.DoNothing)
         self.assertEqual(action.required_bits, set())
 
     def test_new_location_one_action(self):
-        location = LocationCard.new_location({'actions': [
-            {'required_bits': [], 'action_class': 'DoNothing'},
+        location = LocationCard.new_location({'card_name': 'card1',
+            'actions': [{'required_bits': [], 'action_class': 'DoNothing'},
         ]})
         [action] = location.actions
         self.assertEqual(type(action), actions.DoNothing)