Exemple #1
0
 def testJsonString(self):
     codec = jsonCodec()
     message = codec.decode(DummyPahoMessage("bar"))
     try:
         assert_true(isinstance(message.data, unicode))
     except NameError as e:
         # Python 3
         assert_true(isinstance(message.data, str))
Exemple #2
0
 def testInvalidJson(self):
     codec = jsonCodec()
     message = codec.decode(NonJsonDummyPahoMessage('{sss,eee}'))
Exemple #3
0
 def testJsonInt(self):
     codec = jsonCodec()
     message = codec.decode(DummyPahoMessage(1))
     assert_true(isinstance(message.data, int))
Exemple #4
0
 def testJsonBoolean(self):
     codec = jsonCodec()
     message = codec.decode(DummyPahoMessage(False))
     assert_true(isinstance(message.data, bool))
Exemple #5
0
 def testJsonObject(self):
     codec = jsonCodec()
     message = codec.decode(DummyPahoMessage({"foo": "bar"}))
     assert_true(isinstance(message.data, dict))
     assert_equals(message.data["foo"], "bar")