Exemple #1
0
 def test_deserialize(self):
     renderer = JsonRenderer()
     procedure = {
         'id':1,
         'method': 'messages.sendMessage',
         'params': {'to':'chat','message':'Hello World!'},
     }
     json_procedure = json.dumps(procedure)
     self.assertDictEqual(renderer.deserialize(json_procedure), procedure)
Exemple #2
0
 def test_deserialize_invalid_json_raises_error(self):
     renderer = JsonRenderer()
     json_procedure = '{"id":1,"method":to":"chat","message":"Hello Wor'
     with self.assertRaises(RPCParseError):
         renderer.deserialize(json_procedure)