Fix wrong value of require_confirmation
Currently, Zaqar's notifier driver will be initialized without any parameter when creating the subscription controller. As a result, default value 'False' will be used instead of getting the correct value from conf. This patch will fix this by getting the option from conf. Closes-Bug: #1655812 Change-Id: I31ac8c3d374b3ea38d035f1012571e6c49a18b87
This commit is contained in:
@@ -83,8 +83,12 @@ class NotifierDriver(object):
|
|||||||
project=None, expires=None,
|
project=None, expires=None,
|
||||||
api_version=None):
|
api_version=None):
|
||||||
# NOTE(flwang): If the confirmation feature isn't enabled, just do
|
# NOTE(flwang): If the confirmation feature isn't enabled, just do
|
||||||
# nothing.
|
# nothing. Here we're getting the require_confirmation from conf
|
||||||
if not self.require_confirmation:
|
# object instead of using self.require_confirmation, because the
|
||||||
|
# variable from self object really depends on the kwargs when
|
||||||
|
# initializing the NotifierDriver object. See bug 1655812 for more
|
||||||
|
# information.
|
||||||
|
if not conf.notification.require_confirmation:
|
||||||
return
|
return
|
||||||
|
|
||||||
key = conf.signed_url.secret_key
|
key = conf.signed_url.secret_key
|
||||||
|
|||||||
@@ -264,6 +264,7 @@ class NotifierTest(testing.TestBase):
|
|||||||
|
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
def test_send_confirm_notification(self, mock_request):
|
def test_send_confirm_notification(self, mock_request):
|
||||||
|
self.conf.notification.require_confirmation = True
|
||||||
subscription = {'id': '5760c9fb3990b42e8b7c20bd',
|
subscription = {'id': '5760c9fb3990b42e8b7c20bd',
|
||||||
'subscriber': 'http://trigger_me',
|
'subscriber': 'http://trigger_me',
|
||||||
'source': 'fake_queue',
|
'source': 'fake_queue',
|
||||||
|
|||||||
Reference in New Issue
Block a user