#NEWLINE# def test_migrate_disk_resizing_down_works_no_ephemeral( self , mock_destroy_vdi , mock_migrate_vhd , mock_resize_disk , mock_get_vdi_for_vm_safely , mock_update_instance_progress , mock_apply_orig_vm_name_label , mock_resize_ensure_vm_is_shutdown ) : #NEWLINE# #INDENT# context = 'ctx' #NEWLINE# instance = { #NEWLINE# #INDENT# 'name' : 'fake' , #NEWLINE# 'uuid' : 'uuid' , #NEWLINE# #UNINDENT# } #NEWLINE# dest = 'dest' #NEWLINE# vm_ref = 'vm_ref' #NEWLINE# sr_path = 'sr_path' #NEWLINE# instance_type = dict ( root_gb = 1 ) #NEWLINE# old_vdi_ref = 'old_ref' #NEWLINE# new_vdi_ref = 'new_ref' #NEWLINE# new_vdi_uuid = 'new_uuid' #NEWLINE# mock_get_vdi_for_vm_safely . return_value = ( old_vdi_ref , None ) #NEWLINE# mock_resize_disk . return_value = ( new_vdi_ref , new_vdi_uuid ) #NEWLINE# self . vmops . _migrate_disk_resizing_down ( context , instance , dest , instance_type , vm_ref , sr_path ) #NEWLINE# mock_get_vdi_for_vm_safely . assert_called_once_with ( self . vmops . _session , vm_ref ) #NEWLINE# mock_resize_ensure_vm_is_shutdown . assert_called_once_with ( instance , vm_ref ) #NEWLINE# mock_apply_orig_vm_name_label . assert_called_once_with ( instance , vm_ref ) #NEWLINE# mock_resize_disk . assert_called_once_with ( self . vmops . _session , instance , old_vdi_ref , instance_type ) #NEWLINE# mock_migrate_vhd . assert_called_once_with ( self . vmops . _session , instance , new_vdi_uuid , dest , sr_path , 0 ) #NEWLINE# mock_destroy_vdi . assert_called_once_with ( self . vmops . _session , new_vdi_ref ) #NEWLINE# prog_expected = [ mock . call ( context , instance , 1 , 5 ) , mock . call ( context , instance , 2 , 5 ) , mock . call ( context , instance , 3 , 5 ) , mock . call ( context , instance , 4 , 5 ) ] #NEWLINE# self . assertEqual ( prog_expected , mock_update_instance_progress . call_args_list )