コード例 #1
0
ファイル: tests.py プロジェクト: yakatz/sentry
    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
コード例 #2
0
ファイル: tests.py プロジェクト: Kayle009/sentry
    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
コード例 #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