def test_serialize_to_str(self): adapter = MessageAdapter() adapter.signature = 'fake_signature' adapter.host_name = 'fake_host_name' adapter.add_host_record(timestamp=self.timestamp(), meter_name='fake_meter_name', value='10', duration=0) adapter.add_inst_record(project_id='fake_project_id', user_id='fake_user_id', inst_id='fake_inst_id', timestamp=self.timestamp(), meter_name='fake_meter_name', value='20', duration=0) self.assertEqual(isinstance(adapter.serialize_to_str(), str), True)
def serialized_data_str(self): adapter = MessageAdapter() adapter.signature = 'fake_signature' adapter.host_name = 'fake_host_name' adapter.add_host_record(timestamp=self.timestamp(), meter_name='fake_meter_name', value='10', duration=0) adapter.add_inst_record(project_id='fake_project_id', user_id='fake_user_id', inst_id='fake_inst_id', timestamp=self.timestamp(), meter_name='fake_meter_name', value='20', duration=0) return adapter.serialize_to_str()