Example #1
0
 def test_loads_str(self):
     self.assertEqual(utils.json_loads('{}'), {})
Example #2
0
 def test_loads_bytes(self):
     self.assertEqual(utils.json_loads(b'{}'), {})
Example #3
0
 def test_loads_invalid(self):
     with self.assertRaises(utils.StatusMsgInvalidJSONError):
         utils.json_loads('+-+-InvalidJSON-AFAICT-+-+')
Example #4
0
 def test_loads_base64(self):
     data = '{"__base64_encoded__": "dGhpcyBpcyBob3cgd2UgZW5jb2RlIGJ5dGVz"}'
     self.assertEqual(utils.json_loads(data),
                      b'this is how we encode bytes')
Example #5
0
 def process_raw_message(self, raw_message):
     raw_message = raw_message.strip()
     message = json_loads(raw_message)
     self.process_message(message)