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'}
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'
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
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