示例#1
0
    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[:]
示例#2
0
    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')
示例#3
0
    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')
示例#4
0
    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[:]
示例#5
0
    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)
示例#6
0
    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[:]