def test_create_raw_data_should_populate_rawdata_and_rawdata_imagemeta( self): deployment = db.get_or_create_deployment('deployment1')[0] kwargs = { 'deployment': deployment, 'when': dt_to_decimal(datetime.utcnow()), 'tenant': '1', 'json': '{}', 'routing_key': 'monitor.info', 'state': 'verifying', 'old_state': 'pending', 'old_task': 'building', 'task': 'saving', 'image_type': 1, 'publisher': 'publisher', 'event': 'compute.instance.exists', 'service': 'compute', 'host': 'host', 'instance': '1234-5678-9012-3456', 'request_id': '1234', 'os_architecture': 'x86', 'os_version': '1', 'os_distro': 'windows', 'rax_options': '2' } rawdata = db.create_nova_rawdata(**kwargs) for field in get_model_fields(RawData): if field.name != 'id': self.assertEquals(getattr(rawdata, field.name), kwargs[field.name]) raw_image_meta = RawDataImageMeta.objects.filter(raw_id=rawdata.id)[0] self.assertEquals(raw_image_meta.os_architecture, kwargs['os_architecture']) self.assertEquals(raw_image_meta.os_version, kwargs['os_version']) self.assertEquals(raw_image_meta.os_distro, kwargs['os_distro']) self.assertEquals(raw_image_meta.rax_options, kwargs['rax_options'])
def test_create_raw_data_should_populate_rawdata_and_rawdata_imagemeta(self): deployment = db.get_or_create_deployment('deployment1')[0] kwargs = { 'deployment': deployment, 'when': dt_to_decimal(datetime.utcnow()), 'tenant': '1', 'json': '{}', 'routing_key': 'monitor.info', 'state': 'verifying', 'old_state': 'pending', 'old_task': 'building', 'task': 'saving', 'image_type': 1, 'publisher': 'publisher', 'event': 'compute.instance.exists', 'service': 'compute', 'host': 'host', 'instance': '1234-5678-9012-3456', 'request_id': '1234', 'os_architecture': 'x86', 'os_version': '1', 'os_distro': 'windows', 'rax_options': '2'} rawdata = db.create_nova_rawdata(**kwargs) for field in get_model_fields(RawData): if field.name != 'id': self.assertEquals(getattr(rawdata, field.name), kwargs[field.name]) raw_image_meta = RawDataImageMeta.objects.filter(raw_id=rawdata.id)[0] self.assertEquals(raw_image_meta.os_architecture, kwargs['os_architecture']) self.assertEquals(raw_image_meta.os_version, kwargs['os_version']) self.assertEquals(raw_image_meta.os_distro, kwargs['os_distro']) self.assertEquals(raw_image_meta.rax_options, kwargs['rax_options'])
1L, ' ', '2013-07-17 10:16:10.717219', 'depl', 'event', 'host', 'state', 'old_state', 'old_task' ]] depl = db.get_or_create_deployment('depl')[0] when = dt.dt_to_decimal(datetime.utcnow()) raw = db.create_nova_rawdata(deployment=depl, routing_key='routing_key', tenant='tenant', json='json', when=when, publisher='publisher', event='event', service='nova', host='host', instance='instance', request_id='req-1234', state='state', old_state='old_state', task='task', old_task='old_task', os_architecture='arch', os_distro='distro', os_version='version', rax_options=1) results = raw.search_results({}, "2013-07-17 10:16:10.717219", ' ') self.assertEqual(results, expected_result) def test_search_results_for_glance(self): expected_result = [[
expected_result = [['#', '?', 'When', 'Deployment', 'Event', 'Host', 'State', "State'", "Task'"], [1L, ' ', '2013-07-17 10:16:10.717219', 'depl', 'event', 'host', 'state', 'old_state', 'old_task']] depl = db.get_or_create_deployment('depl')[0] when = dt.dt_to_decimal(datetime.utcnow()) raw = db.create_nova_rawdata(deployment=depl, routing_key='routing_key', tenant='tenant', json='json', when=when, publisher='publisher', event='event', service='nova', host='host', instance='instance', request_id='req-1234', state='state', old_state='old_state', task='task', old_task='old_task', os_architecture='arch', os_distro='distro', os_version='version', rax_options=1) results = raw.search_results({}, "2013-07-17 10:16:10.717219", ' ') self.assertEqual(results,expected_result) def test_search_results_for_glance(self): expected_result = [['#', '?', 'When', 'Deployment', 'Event', 'Host',