import errno
import os
+import mock
import mox as mox_lib
from mox import IgnoreArg
from mox import IsA
def test_delete_should_not_delete_if_provider_location_not_provided(self):
"""delete_volume shouldn't delete if provider_location missed."""
- mox = self._mox
drv = self._driver
- self.stub_out_not_replaying(drv, '_ensure_share_mounted')
+ self.stubs.Set(drv, '_ensure_share_mounted', mock.Mock())
+ self.stubs.Set(drv, 'local_path', mock.Mock())
volume = DumbVolume()
volume['name'] = 'volume-123'
volume['provider_location'] = None
- mox.StubOutWithMock(drv, '_execute')
-
- mox.ReplayAll()
-
- drv.delete_volume(volume)
+ with mock.patch.object(drv, '_execute') as mock_execute:
+ drv.delete_volume(volume)
- mox.VerifyAll()
+ self.assertEqual(mock_execute.call_count, 0)
def test_get_volume_stats(self):
"""get_volume_stats must fill the correct values."""