示例#1
0
def test_error_4XX_status_code_message():
    response = Response()
    response.set_status_code(426)
    check = response.error_4XX('I\'m a teapot!!!')
    assert check['statusCode'] == 426
    assert check['body'] == '{"message": "I\'m a teapot!!!"}'
    assert check['headers']['Access-Control-Allow-Origin'] == '*'
示例#2
0
def test_error_4XX_message():
    response = Response()
    check = response.error_4XX('this is a program error')
    assert check['statusCode'] == 422
    assert check['body'] == '{"message": "this is a program error"}'
    assert check['headers']['Access-Control-Allow-Origin'] == '*'
示例#3
0
def test_error_4XX():
    response = Response()
    check = response.error_4XX()
    assert check['statusCode'] == 422
    assert check['body'] is None
    assert check['headers']['Access-Control-Allow-Origin'] == '*'