]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add missing argument to delete_keys method
authorDaisuke Fujita <fuzita.daisuke@jp.fujitsu.com>
Fri, 12 Jun 2015 08:55:28 +0000 (17:55 +0900)
committerDaisuke Fujita <fuzita.daisuke@jp.fujitsu.com>
Fri, 19 Jun 2015 04:31:58 +0000 (04:31 +0000)
Method delete_keys in class QoSSpecsController is
missing argument 'QoSSpecs' when calling get_notifier.
This patch adds missing argument.

Closes-Bug: #1443340
Change-Id: Ie53fdd41486fdb7d0694a4a1b7015ba7bcd3c161

cinder/api/contrib/qos_specs_manage.py
cinder/tests/unit/api/contrib/test_qos_specs_manage.py

index 434bacd9d44ef083937bfe2c76b4ff250579eafb..da3db5e010ccc653ee167937c8e9d441cb7b26c9 100644 (file)
@@ -264,8 +264,8 @@ class QoSSpecsController(wsgi.Controller):
         try:
             qos_specs.delete_keys(context, id, keys)
             notifier_info = dict(id=id)
-            rpc.get_notifier().info(context, 'qos_specs.delete_keys',
-                                    notifier_info)
+            rpc.get_notifier('QoSSpecs').info(context, 'qos_specs.delete_keys',
+                                              notifier_info)
         except exception.QoSSpecsNotFound as err:
             notifier_err = dict(id=id, error_message=err)
             self._notify_qos_specs_error(context,
index 27119667aad13e35df63d6abe090e3fd7e3fe833..d2947d23af94fcb05820c1685358fab9b06d5a28 100644 (file)
@@ -272,6 +272,18 @@ class QoSSpecManageApiTest(test.TestCase):
                               req, '666', body)
             self.assertEqual(1, notifier.get_notification_count())
 
+    @mock.patch('cinder.volume.qos_specs.delete_keys',
+                side_effect=return_qos_specs_delete_keys)
+    def test_qos_specs_delete_keys_get_notifier(self, mock_qos_delete_keys):
+        body = {"keys": ['bar', 'zoo']}
+        req = fakes.HTTPRequest.blank('/v2/fake/qos-specs/666/delete_keys')
+
+        notifier = fake_notifier.get_fake_notifier()
+        with mock.patch('cinder.rpc.get_notifier', return_value=notifier,
+                        autospec=True) as mock_get_notifier:
+            self.controller.delete_keys(req, '666', body)
+            mock_get_notifier.assert_called_once_with('QoSSpecs')
+
     @mock.patch('cinder.volume.qos_specs.create',
                 side_effect=return_qos_specs_create)
     @mock.patch('cinder.volume.qos_specs.get_qos_specs_by_name',