@@ -887,7 +887,7 @@ def test_attach_cd(self):
887887class UnplugVbdTestCase (VMUtilsTestBase ):
888888 @mock .patch .object (greenthread , 'sleep' )
889889 def test_unplug_vbd_works (self , mock_sleep ):
890- session = mock . Mock ()
890+ session = _get_fake_session ()
891891 vbd_ref = "vbd_ref"
892892 vm_ref = 'vm_ref'
893893
@@ -897,7 +897,7 @@ def test_unplug_vbd_works(self, mock_sleep):
897897 self .assertEqual (0 , mock_sleep .call_count )
898898
899899 def test_unplug_vbd_raises_unexpected_error (self ):
900- session = mock . Mock ()
900+ session = _get_fake_session ()
901901 vbd_ref = "vbd_ref"
902902 vm_ref = 'vm_ref'
903903 session .call_xenapi .side_effect = test .TestingException ()
@@ -1742,16 +1742,13 @@ class VDIAttachedHere(VMUtilsTestBase):
17421742 @mock .patch .object (vm_utils , 'destroy_vbd' )
17431743 @mock .patch .object (vm_utils , '_get_this_vm_ref' )
17441744 @mock .patch .object (vm_utils , 'create_vbd' )
1745- @mock .patch .object (volume_utils , 'vbd_plug' )
17461745 @mock .patch .object (vm_utils , '_remap_vbd_dev' )
17471746 @mock .patch .object (vm_utils , '_wait_for_device' )
17481747 @mock .patch .object (utils , 'execute' )
1749- @mock .patch .object (vm_utils , 'unplug_vbd' )
1750- def test_sync_called (self , mock_unplug_vbd , mock_execute ,
1751- mock_wait_for_device , mock_remap_vbd_dev ,
1752- mock_vbd_plug , mock_create_vbd ,
1748+ def test_sync_called (self , mock_execute , mock_wait_for_device ,
1749+ mock_remap_vbd_dev , mock_create_vbd ,
17531750 mock_get_this_vm_ref , mock_destroy_vbd ):
1754- session = mock . Mock ()
1751+ session = _get_fake_session ()
17551752 with vm_utils .vdi_attached_here (session , 'vdi_ref' ):
17561753 pass
17571754 mock_execute .assert_called_with ('sync' , run_as_root = True )
0 commit comments