From 61e501e51902ebbf95c644199bfdcc9e5cd4867a Mon Sep 17 00:00:00 2001 From: Alex Meade Date: Mon, 24 Feb 2014 14:08:37 -0500 Subject: [PATCH] Fix test_delete_should_not_.. to assert something This changes test_delete_should_not_delete_if_provider_location_not_provided to assert the case it is testing. Closes-bug: 1284263 Change-Id: I25160140e15721e0de4251ba2373a560d4b0ad46 --- cinder/tests/test_nfs.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/cinder/tests/test_nfs.py b/cinder/tests/test_nfs.py index 9e73d41e1..27b38fc1c 100644 --- a/cinder/tests/test_nfs.py +++ b/cinder/tests/test_nfs.py @@ -18,6 +18,7 @@ import errno import os +import mock import mox as mox_lib from mox import IgnoreArg from mox import IsA @@ -588,22 +589,19 @@ class NfsDriverTestCase(test.TestCase): 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.""" -- 2.45.2