def test_can_deserialize_dict(self):
     handler = BaseRestHandler(mock.MagicMock(), mock.MagicMock())
     handler._write_buffer = []
     obj = {"key": "value"}
     handler.write_object(obj)
     json = handler._write_buffer[0]
     self.assertTrue(json == '{"key": "value"}')
 def test_can_deserialize_plain_object(self):
     """Sending an non-list/non-dict object to write_object deserializes it as json"""
     handler = BaseRestHandler(mock.MagicMock(), mock.MagicMock())
     handler._write_buffer = []
     obj = SerializeMe()
     obj.key = "value"
     handler.write_object(obj)
     json = handler._write_buffer[0]
     self.assertTrue(json == '{"key": "value"}')