]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix test_delete_should_not_.. to assert something
authorAlex Meade <mr.alex.meade@gmail.com>
Mon, 24 Feb 2014 19:08:37 +0000 (14:08 -0500)
committerAlex Meade <mr.alex.meade@gmail.com>
Tue, 25 Feb 2014 14:16:23 +0000 (09:16 -0500)
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

index 9e73d41e1916a815ca48dff82cf87982271ef409..27b38fc1cde7e48ad34f0ecb0d6255d43ea43eed 100644 (file)
@@ -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."""