Example #1
0
def test_2XX():
    http_response = Mock(spec=IncomingResponse, status_code=200, swagger_result="hello world")

    # no exception raised == success
    raise_on_expected(http_response)
Example #2
0
def test_non_2XX():
    http_response = Mock(spec=IncomingResponse, status_code=404, swagger_result={"error": "Object not found"})

    with pytest.raises(HTTPError) as excinfo:
        raise_on_expected(http_response)
    assert "Object not found" in str(excinfo.value)
Example #3
0
def test_non_2XX():
    http_response = Mock(spec=IncomingResponse, status_code=404)
    with pytest.raises(HTTPError) as excinfo:
        raise_on_expected(http_response,
                          swagger_return_value={'error': 'Object not found'})
    assert 'Object not found' in str(excinfo.value)
Example #4
0
def test_2XX():
    http_response = Mock(spec=IncomingResponse, status_code=200)
    swagger_return_value = {'msg': 'Request successful'}
    # no error raised == success
    raise_on_expected(http_response, swagger_return_value)
Example #5
0
def test_2XX():
    http_response = Mock(spec=IncomingResponse, status_code=200)
    swagger_return_value = {"msg": "Request successful"}
    # no error raised == success
    raise_on_expected(http_response, swagger_return_value)