#NEWLINE# @ mock . patch . object ( volumeops . VolumeOps , 'get_disk_path_mapping' ) #NEWLINE# def test_fix_instance_volume_disk_paths( self , mock_get_disk_path_mapping ) : #NEWLINE# #INDENT# block_device_info = get_fake_block_dev_info ( ) #NEWLINE# mock_disk1 = { #NEWLINE# #INDENT# 'mounted_disk_path' : mock . sentinel . mounted_disk1_path , #NEWLINE# 'resource_path' : mock . sentinel . resource1_path , #NEWLINE# #UNINDENT# } #NEWLINE# mock_disk2 = { #NEWLINE# #INDENT# 'mounted_disk_path' : mock . sentinel . mounted_disk2_path , #NEWLINE# 'resource_path' : mock . sentinel . resource2_path , #NEWLINE# #UNINDENT# } #NEWLINE# mock_vm_disk_mapping = { #NEWLINE# #INDENT# mock . sentinel . disk1_serial : mock_disk1 , #NEWLINE# mock . sentinel . disk2_serial : mock_disk2 , #NEWLINE# #UNINDENT# } #NEWLINE# mock_phys_disk_path_mapping = { #NEWLINE# #INDENT# mock . sentinel . disk1_serial : mock . sentinel . actual_disk1_path , #NEWLINE# mock . sentinel . disk2_serial : mock . sentinel . mounted_disk2_path , #NEWLINE# #UNINDENT# } #NEWLINE# vmutils = self . _volumeops . _vmutils #NEWLINE# vmutils . get_vm_physical_disk_mapping . return_value = mock_vm_disk_mapping #NEWLINE# mock_get_disk_path_mapping . return_value = mock_phys_disk_path_mapping #NEWLINE# self . _volumeops . fix_instance_volume_disk_paths ( mock . sentinel . instance_name , vmutils ) #NEWLINE# vmutils . get_vm_physical_disk_mapping . assert_called_once_with ( mock . sentinel . instance_name ) #NEWLINE# mock_get_disk_path_mapping . assert_called_once_with ( block_device_info ) #NEWLINE# vmutils . set_disk_host_res . assert_called_once_with ( mock . sentinel . resource1_path , mock . sentinel . actual_disk1_path )