#NEWLINE# @ mock . patch . object ( volume_utils , 'is_booted_from_volume' , return_value = False ) #NEWLINE# def test_migrate_disk_resizing_up_works_no_ephemeral( self , mock_is_booted_from_volume , mock_apply_orig , mock_update_progress , mock_get_all_vdi_uuids , mock_shutdown , mock_migrate_vhd , mock_get_vdi_for_vm ) : #NEWLINE# #INDENT# context = 'ctxt' #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# mock_get_all_vdi_uuids . return_value = None #NEWLINE# mock_get_vdi_for_vm . return_value = ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'uuid' : 'root' , #NEWLINE# #UNINDENT# } ) #NEWLINE# with mock . patch . object ( vm_utils , '_snapshot_attached_here_impl' , self . _fake_snapshot_attached_here ) : #NEWLINE# #INDENT# self . vmops . _migrate_disk_resizing_up ( context , instance , dest , vm_ref , sr_path ) #NEWLINE# #UNINDENT# mock_get_all_vdi_uuids . assert_called_once_with ( self . vmops . _session , vm_ref , min_userdevice = 4 ) #NEWLINE# mock_apply_orig . assert_called_once_with ( instance , vm_ref ) #NEWLINE# mock_shutdown . assert_called_once_with ( instance , vm_ref ) #NEWLINE# m_vhd_expected = [ mock . call ( self . vmops . _session , instance , 'parent' , dest , sr_path , 1 ) , mock . call ( self . vmops . _session , instance , 'grandp' , dest , sr_path , 2 ) , mock . call ( self . vmops . _session , instance , 'root' , dest , sr_path , 0 ) ] #NEWLINE# self . assertEqual ( m_vhd_expected , mock_migrate_vhd . call_args_list ) #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_progress . call_args_list )