

@mock.patch.object(request_spec.RequestSpec, '_get_by_instance_uuid_from_db')
def test_get_by_instance_uuid(self, get_by_uuid):
    fake_spec = fake_request_spec.fake_db_spec()
    get_by_uuid.return_value = fake_spec
    req_obj = request_spec.RequestSpec.get_by_instance_uuid(self.context, fake_spec['instance_uuid'])
    self.assertEqual(1, req_obj.num_instances)
    self.assertEqual(['host2', 'host4'], req_obj.ignore_hosts)
    self.assertEqual('fake', req_obj.project_id)
    self.assertEqual({
        'hint': ['over-there'],
    }, req_obj.scheduler_hints)
    self.assertEqual(['host1', 'host3'], req_obj.force_hosts)
    self.assertIsNone(req_obj.availability_zone)
    self.assertEqual(['node1', 'node2'], req_obj.force_nodes)
    self.assertIsInstance(req_obj.image, objects.ImageMeta)
    self.assertIsInstance(req_obj.numa_topology, objects.InstanceNUMATopology)
    req_obj.assertIsInstance(req_obj.pci_requests, objects.InstancePCIRequests)
    self.assertIsInstance(req_obj.flavor, objects.Flavor)
    self.assertIsInstance(req_obj.retry, objects.SchedulerRetries)
    self.assertIsInstance(req_obj.limits, objects.SchedulerLimits)
    self.assertIsInstance(req_obj.instance_group, objects.InstanceGroup)

dataset/ETHPy150Open openstack/nova/nova/tests/unit/objects/test_request_spec.py _TestRequestSpecObject.test_get_by_instance_uuid/VarMisuse@180/299 `self`->`req_obj`