Merge "Don't mock internal implementation details of oslo"

This commit is contained in:
Zuul 2018-10-10 01:37:39 +00:00 committed by Gerrit Code Review
commit 618a0fb028

View File

@ -141,12 +141,11 @@ class NotificationsTestCase(unit.BaseTestCase):
expected_args = [ expected_args = [
{}, # empty context {}, # empty context
'identity.%s.created' % resource_type, # event_type 'identity.%s.created' % resource_type, # event_type
{'resource_info': resource}, # payload {'resource_info': resource} # payload
'INFO', # priority is always INFO...
] ]
with mock.patch.object(notifications._get_notifier(), with mock.patch.object(notifications._get_notifier(),
'_notify') as mocked: 'info') as mocked:
notifications._send_notification(operation, resource_type, notifications._send_notification(operation, resource_type,
resource) resource)
mocked.assert_called_once_with(*expected_args) mocked.assert_called_once_with(*expected_args)
@ -170,7 +169,7 @@ class NotificationsTestCase(unit.BaseTestCase):
conf.config(notification_opt_out=[event_type]) conf.config(notification_opt_out=[event_type])
with mock.patch.object(notifications._get_notifier(), with mock.patch.object(notifications._get_notifier(),
'_notify') as mocked: 'info') as mocked:
notifications._send_notification(operation, resource_type, notifications._send_notification(operation, resource_type,
resource) resource)
@ -194,7 +193,7 @@ class NotificationsTestCase(unit.BaseTestCase):
conf.config(notification_opt_out=[event_type]) conf.config(notification_opt_out=[event_type])
with mock.patch.object(notifications._get_notifier(), with mock.patch.object(notifications._get_notifier(),
'_notify') as mocked: 'info') as mocked:
notifications._send_audit_notification(action, notifications._send_audit_notification(action,
initiator, initiator,
@ -218,7 +217,7 @@ class NotificationsTestCase(unit.BaseTestCase):
conf.config(notification_opt_out=[meter_name]) conf.config(notification_opt_out=[meter_name])
with mock.patch.object(notifications._get_notifier(), with mock.patch.object(notifications._get_notifier(),
'_notify') as mocked: 'info') as mocked:
notifications._send_audit_notification(action, notifications._send_audit_notification(action,
initiator, initiator,
@ -1341,7 +1340,7 @@ class CADFNotificationsDataTestCase(test_v3.RestfulTestCase):
event_type = 'identity.authenticate.created' event_type = 'identity.authenticate.created'
with mock.patch.object(notifications._get_notifier(), with mock.patch.object(notifications._get_notifier(),
'_notify') as mocked: 'info') as mocked:
notifications._send_audit_notification(action, notifications._send_audit_notification(action,
initiator, initiator,