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])
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])