示例#1
0
def test_4XX(_1):
    incoming_response = Mock(spec=IncomingResponse, status_code=404)
    operation = Mock(spec=Operation)
    with pytest.raises(HTTPError) as excinfo:
        response_callback(incoming_response, operation)
    assert excinfo.value.response.status_code == 404
    assert excinfo.value.swagger_result == {'msg': 'Not found'}
示例#2
0
def test_2XX_matching_response_not_found_in_spec(_1):
    incoming_response = Mock(spec=IncomingResponse, status_code=200)
    operation = Mock(spec=Operation)
    with pytest.raises(HTTPError) as excinfo:
        response_callback(incoming_response, operation)
    assert excinfo.value.response.status_code == 200
    assert excinfo.value.message == 'boo'
示例#3
0
def test_2XX(_1):
    incoming_response = Mock(spec=IncomingResponse)
    incoming_response.status_code = 200
    operation = Mock(spec=Operation)
    swagger_result = response_callback(incoming_response, operation)
    assert swagger_result == 99
示例#4
0
def test_5XX():
    incoming_response = Mock(spec=IncomingResponse, status_code=500)
    operation = Mock(spec=Operation)
    with pytest.raises(HTTPError) as excinfo:
        response_callback(incoming_response, operation)
    assert excinfo.value.response.status_code == 500