예제 #1
0
    def test_multiple_args_to_json(self):
        """Convert GameAction to JSON.
        """
        a = GameAction(message.LEADROLE, 'Craftsman', 1, 106, 107, 108)

        a_json = a.to_json()

        d = json.loads(a_json)
        action, args = d['action'], d['args']

        self.assertEqual(action, message.LEADROLE)
        self.assertEqual(args, ['Craftsman', 1, 106, 107, 108])
예제 #2
0
    def test_multiple_args_to_json(self):
        """Convert GameAction to JSON.
        """
        a = GameAction(message.LEADROLE, 'Craftsman', 1, 106, 107, 108)

        a_json = a.to_json()

        d = json.loads(a_json)
        action, args = d['action'], d['args']

        self.assertEqual(action, message.LEADROLE)
        self.assertEqual(args, ['Craftsman', 1, 106, 107, 108])
예제 #3
0
    def test_to_json(self):
        """Convert GameAction to JSON.
        """
        a = GameAction(message.THINKERORLEAD, True)

        a_json = a.to_json()

        d = json.loads(a_json)

        self.assertIn('action', d.keys())
        self.assertIn('args', d.keys())

        action, args = d['action'], d['args']

        self.assertEqual(action, message.THINKERORLEAD)
        self.assertEqual(args, [True])
예제 #4
0
    def test_to_json(self):
        """Convert GameAction to JSON.
        """
        a = GameAction(message.THINKERORLEAD, True)

        a_json = a.to_json()

        d = json.loads(a_json)

        self.assertIn('action', d.keys())
        self.assertIn('args', d.keys())
        
        action, args = d['action'], d['args']

        self.assertEqual(action, message.THINKERORLEAD)
        self.assertEqual(args, [True])