コード例 #1
0
def test_error_handler_status_message():
    test_error = web.HTTPError(102, test_message, status_message=test_status)

    headers, response = run('GET',
                            handler=web.HTTPErrorHandler,
                            handler_args={'error': test_error})

    assert response[0] == test_error.code
    assert response[1] == test_status
    assert response[2] == test_message.decode() + '\n'
コード例 #2
0
def test_error_handler():
    test_error = web.HTTPError(102)

    headers, response = run('GET',
                            handler=web.HTTPErrorHandler,
                            handler_args={'error': test_error})

    assert response[0] == test_error.code
    assert response[1] == web.status_messages[test_error.code]
    assert response[2] == str(
        test_error.code) + ' - ' + web.status_messages[test_error.code] + '\n'
コード例 #3
0
    def __init__(self, request, response, groups, error=None):
        if error is None:
            error = web.HTTPError(500)

        MockHTTPHandler.__init__(self, request, response, groups)
        self.error = error
コード例 #4
0
    def respond(self):
        self.error = web.HTTPError(500,
                                   message=test_object,
                                   status_message='a')

        return super().respond()
コード例 #5
0
    def respond(self):
        self.error = web.HTTPError(500)

        return super().respond()
コード例 #6
0
 def check_continue(self):
     raise web.HTTPError(417)