#NEWLINE# def test_with_pci_devices( self ) : #NEWLINE# #INDENT# fake_inst = dict ( self . fake_instance ) #NEWLINE# fake_uuid = self [ 'uuid' ] #NEWLINE# fake_inst [ 'pci_devices' ] = [ { #NEWLINE# #INDENT# 'created_at' : None , #NEWLINE# 'updated_at' : None , #NEWLINE# 'deleted_at' : None , #NEWLINE# 'deleted' : None , #NEWLINE# 'id' : 2 , #NEWLINE# 'compute_node_id' : 1 , #NEWLINE# 'address' : 'a1' , #NEWLINE# 'vendor_id' : 'v1' , #NEWLINE# 'numa_node' : 0 , #NEWLINE# 'product_id' : 'p1' , #NEWLINE# 'dev_type' : fields . PciDeviceType . STANDARD , #NEWLINE# 'status' : fields . PciDeviceStatus . ALLOCATED , #NEWLINE# 'dev_id' : 'i' , #NEWLINE# 'label' : 'l' , #NEWLINE# 'instance_uuid' : fake_uuid , #NEWLINE# 'request_id' : None , #NEWLINE# 'parent_addr' : None , #NEWLINE# 'extra_info' : '{}' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'created_at' : None , #NEWLINE# 'updated_at' : None , #NEWLINE# 'deleted_at' : None , #NEWLINE# 'deleted' : None , #NEWLINE# 'id' : 1 , #NEWLINE# 'compute_node_id' : 1 , #NEWLINE# 'address' : 'a' , #NEWLINE# 'vendor_id' : 'v' , #NEWLINE# 'numa_node' : 1 , #NEWLINE# 'product_id' : 'p' , #NEWLINE# 'dev_type' : fields . PciDeviceType . STANDARD , #NEWLINE# 'status' : fields . PciDeviceStatus . ALLOCATED , #NEWLINE# 'dev_id' : 'i' , #NEWLINE# 'label' : 'l' , #NEWLINE# 'instance_uuid' : fake_uuid , #NEWLINE# 'request_id' : None , #NEWLINE# 'parent_addr' : 'a1' , #NEWLINE# 'extra_info' : '{}' , #NEWLINE# #UNINDENT# } ] #NEWLINE# self . mox . StubOutWithMock ( db , 'instance_get_by_uuid' ) #NEWLINE# db . instance_get_by_uuid ( self . context , fake_uuid , columns_to_join = [ 'pci_devices' ] ) . AndReturn ( fake_inst ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# inst = objects . Instance . get_by_uuid ( self . context , fake_uuid , [ 'pci_devices' ] ) #NEWLINE# self . assertEqual ( 2 , len ( inst . pci_devices ) ) #NEWLINE# self . assertEqual ( fake_uuid , inst . pci_devices [ 0 ] . instance_uuid ) #NEWLINE# self . assertEqual ( fake_uuid , inst . pci_devices [ 1 ] . instance_uuid )