#NEWLINE# def test_migrate( self ) : #NEWLINE# #INDENT# '\n            Test to migrates the virtual machine to another hypervisor\n        ' #NEWLINE# with patch . object ( xapi , '_get_xapi_session' , MagicMock ( ) ) : #NEWLINE# #INDENT# mock = MagicMock ( side_effect = [ False , [ 'a' , 'b' , 'c' ] ] ) #NEWLINE# with patch . object ( xapi , '_get_label_uuid' , mock ) : #NEWLINE# #INDENT# self . assertFalse ( xapi . migrate ( 'salt' , 'stack' ) ) #NEWLINE# self . assertTrue ( xapi . migrate ( 'salt' , 'stack' ) ) #NEWLINE# #UNINDENT# #UNINDENT# with patch . object ( xapi , '_check_xenapi' , MagicMock ( return_value = Mockxapi ) ) : #NEWLINE# #INDENT# mock = MagicMock ( return_value = True ) #NEWLINE# with patch . dict ( xapi . __salt__ , { #NEWLINE# #INDENT# 'config.option' : mock , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# with patch . object ( xapi , '_get_label_uuid' , mock ) : #NEWLINE# #INDENT# self . assertFalse ( xapi . migrate ( 'salt' , 'stack' ) )