def setUp(self): super(NotifyEventsTest, self).setUp() self.publishers = { 'wbhk': notif.get_notification_publisher('webhook'), 'noop': notif.get_notification_publisher('noop') } self.publishers['wbhk'].publish = mock.MagicMock(side_effect=log_event) self.publishers['wbhk'].publish.reset_mock() self.publishers['noop'].publish = mock.MagicMock(side_effect=log_event) self.publishers['noop'].publish.reset_mock() del EVENT_LOGS[:]
def setUp(self): super(NotifyEventsTest, self).setUp() self.publishers = { 'wbhk': notif.get_notification_publisher('webhook'), 'noop': notif.get_notification_publisher('noop') } self.publishers['wbhk'].publish = mock.MagicMock(side_effect=log_event) self.publishers['wbhk'].publish.reset_mock() self.publishers['noop'].publish = mock.MagicMock(side_effect=log_event) self.publishers['noop'].publish.reset_mock() del EVENT_LOGS[:] cfg.CONF.set_default('type', 'local', group='notifier')
def setUp(self): super(NotifyEventsTest, self).setUp() self.publishers = { 'wbhk': notif.get_notification_publisher('webhook'), 'noop': notif.get_notification_publisher('noop') } self.publishers['wbhk'].publish = mock.MagicMock(side_effect=log_event) self.publishers['wbhk'].publish.reset_mock() self.publishers['noop'].publish = mock.MagicMock(side_effect=log_event) self.publishers['noop'].publish.reset_mock() del EVENT_LOGS[:] cfg.CONF.set_default('type', 'local', group='notifier')
def setUp(self): super(LocalNotifServerTest, self).setUp() self.publisher = notif.get_notification_publisher('webhook') self.publisher.publish = mock.MagicMock(side_effect=publisher_process) self.publisher.publish.reset_mock() del EVENT_LOGS[:]
def notify(self, ex_id, data, event, timestamp, publishers): for entry in publishers: params = copy.deepcopy(entry) publisher_name = params.pop('type', None) if not publisher_name: LOG.error('Notification publisher type is not specified.') continue try: publisher = base.get_notification_publisher(publisher_name) publisher.publish(ex_id, data, event, timestamp, **params) except Exception: LOG.exception('Unable to process event for publisher "%s".', publisher_name)
def notify(self, ex_id, data, event, timestamp, publishers): ctx = auth_ctx.ctx() for entry in publishers: params = copy.deepcopy(entry) publisher_name = params.pop('type', None) if not publisher_name: LOG.error('Notification publisher type is not specified.') continue try: publisher = base.get_notification_publisher(publisher_name) publisher.publish(ctx, ex_id, data, event, timestamp, **params) except Exception: LOG.exception( 'Unable to process event for publisher "%s".', publisher_name )
def setUp(self): super(LocalNotifServerTestCase, self).setUp() self.publisher = notif.get_notification_publisher('webhook') self.publisher.publish = mock.MagicMock(side_effect=publisher_process) self.publisher.publish.reset_mock() del EVENT_LOGS[:]