From: Daisuke Fujita Date: Fri, 12 Jun 2015 08:55:28 +0000 (+0900) Subject: Add missing argument to delete_keys method X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=46cdbba12c1caae07f21b3cf74b559a3bd72caee;p=openstack-build%2Fcinder-build.git Add missing argument to delete_keys method 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 --- diff --git a/cinder/api/contrib/qos_specs_manage.py b/cinder/api/contrib/qos_specs_manage.py index 434bacd9d..da3db5e01 100644 --- a/cinder/api/contrib/qos_specs_manage.py +++ b/cinder/api/contrib/qos_specs_manage.py @@ -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, diff --git a/cinder/tests/unit/api/contrib/test_qos_specs_manage.py b/cinder/tests/unit/api/contrib/test_qos_specs_manage.py index 27119667a..d2947d23a 100644 --- a/cinder/tests/unit/api/contrib/test_qos_specs_manage.py +++ b/cinder/tests/unit/api/contrib/test_qos_specs_manage.py @@ -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',