]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix exception handling on test_delete_nonexistent_volume
authorEiichi Aikawa <aikawa@mxk.nes.nec.co.jp>
Fri, 26 Sep 2014 06:37:31 +0000 (15:37 +0900)
committerEiichi Aikawa <aikawa@mxk.nes.nec.co.jp>
Sat, 11 Oct 2014 08:39:50 +0000 (17:39 +0900)
test_delete_nonexistent_volume wants to check the exception would be
received when nonexistent volume was specified. But currently, this
test case checks the exception would be received when nonexistent
metadata was specified.

Change-Id: Ia110618d5c658551a1826d495656954be02f4326

cinder/tests/api/v1/test_volume_metadata.py
cinder/tests/api/v2/test_volume_metadata.py

index af6c3fe2fc5eb4725b73e368d2044841e4e80b9b..e6fe56fd57c32df49d881282593ef596bf6e6b80 100644 (file)
@@ -110,7 +110,7 @@ def return_volume(context, volume_id):
             'project_id': context.project_id}
 
 
-def return_volume_nonexistent(context, volume_id):
+def return_volume_nonexistent(*args, **kwargs):
     raise exception.VolumeNotFound('bogus test message')
 
 
@@ -208,7 +208,9 @@ class volumeMetaDataTest(test.TestCase):
         self.assertEqual(200, res.status_int)
 
     def test_delete_nonexistent_volume(self):
-        self.stubs.Set(cinder.db, 'volume_get',
+        self.stubs.Set(cinder.db, 'volume_metadata_get',
+                       return_volume_metadata)
+        self.stubs.Set(cinder.db, 'volume_metadata_delete',
                        return_volume_nonexistent)
         req = fakes.HTTPRequest.blank(self.url + '/key1')
         req.method = 'DELETE'
index 61b169054a9e4ec59279c1ad2842590c0844b9de..a5a999041d3b78039b10af99a473b53ecc8c577f 100644 (file)
@@ -111,7 +111,7 @@ def return_volume(context, volume_id):
             'project_id': context.project_id}
 
 
-def return_volume_nonexistent(context, volume_id):
+def return_volume_nonexistent(*args, **kwargs):
     raise exception.VolumeNotFound('bogus test message')
 
 
@@ -209,7 +209,9 @@ class volumeMetaDataTest(test.TestCase):
         self.assertEqual(200, res.status_int)
 
     def test_delete_nonexistent_volume(self):
-        self.stubs.Set(db, 'volume_get',
+        self.stubs.Set(db, 'volume_metadata_get',
+                       return_volume_metadata)
+        self.stubs.Set(db, 'volume_metadata_delete',
                        return_volume_nonexistent)
         req = fakes.HTTPRequest.blank(self.url + '/key1')
         req.method = 'DELETE'