def test_serializer_from_dict_to_dict(self): obj_id = str(uuid.uuid4()) obj_type = constants.UPDATE_HEALTH obj_payload = {'test': [1, 2, 3, 4], id: obj_id} obj = update_serializer.InfoContainer(obj_id, obj_type, obj_payload) cloned_obj = update_serializer.InfoContainer.from_dict(obj.to_dict()) self.assertEqual(obj, cloned_obj) obj_id = str(uuid.uuid4()) obj_type = constants.UPDATE_HEALTH obj_payload = {'test': [3, 2, 1, 6], id: obj_id, 'x': {'y': 1}} obj = update_serializer.InfoContainer(obj_id, obj_type, obj_payload) cloned_obj = update_serializer.InfoContainer.from_dict(obj.to_dict()) self.assertEqual(obj, cloned_obj)
def emit(self, info_type, info_id, info_obj): cnt = update_serializer.InfoContainer(info_type, info_id, info_obj) self.event_streamer.emit(cnt)