Example #1
0
    def test_notify_failure(self):
        n = NotificationPlugin()
        n.slug = 'slack'

        def hook(*a, **kw):
            raise HTTPError('401 Unauthorized')

        event = self.create_event()
        notification = Notification(event)

        n.notify_users = hook
        assert n.notify(notification) is False
Example #2
0
    def test_notify_failure(self):
        errors = (
            ApiError('The server is sad'),
            SSLError('[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590)'),
            HTTPError('A bad response'),
            PluginError('A plugin is sad'),
        )
        for err in errors:
            n = NotificationPlugin()
            n.slug = 'slack'

            def hook(*a, **kw):
                raise err
            event = self.create_event()
            notification = Notification(event)

            n.notify_users = hook
            assert n.notify(notification) is False
Example #3
0
    def test_notify_failure(self):
        errors = (
            ApiError('The server is sad'),
            SSLError('[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590)'),
            HTTPError('A bad response'),
        )
        for err in errors:
            n = NotificationPlugin()
            n.slug = 'slack'

            def hook(*a, **kw):
                raise err

            event = self.create_event()
            notification = Notification(event)

            n.notify_users = hook
            assert n.notify(notification) is False