

@mock.patch.object(objects.InstancePCIRequests, 'from_request_spec_instance_props')
def test_from_instance_with_pci_requests(self, pci_from_spec):
    fake_pci_requests = objects.InstancePCIRequests()
    pci_from_spec.return_value = fake_pci_requests
    instance = dict(uuid=uuidutils.generate_uuid(), root_gb=10, ephemeral_gb=0, memory_mb=10, vcpus=1, numa_topology=None, project_id=fakes.FAKE_PROJECT_ID, availability_zone='nova', pci_requests={
        'instance_uuid': 'fakeid',
        'requests': [{
            'count': 1,
            'spec': [{
                'vendor_id': '8086',
            }],
        }],
    })
    spec = objects.RequestSpec()
    spec._from_instance(instance)
    pci_from_spec.assert_called_once_with(instance['pci_requests'])
    self.assertEqual(fake_pci_requests, spec.pci_requests)

dataset/ETHPy150Open openstack/nova/nova/tests/unit/objects/test_request_spec.py _TestRequestSpecObject.test_from_instance_with_pci_requests/original