Skip to content

Instantly share code, notes, and snippets.

@lisp-ceo
Created June 21, 2019 00:05
Show Gist options
  • Save lisp-ceo/9040eb2e19e626f55abaffb8e82cd737 to your computer and use it in GitHub Desktop.
Save lisp-ceo/9040eb2e19e626f55abaffb8e82cd737 to your computer and use it in GitHub Desktop.
============================================================================================================================================== FAILURES ==============================================================================================================================================
________________________________________________________________________________________________________________________________ test_get_price_gives_valid_response _________________________________________________________________________________________________________________________________
def test_get_price_gives_valid_response():
"""API gives price information for a consignment"""
# Define the test request
body = {
"sender_org_id": "AAA123",
"carrier_services": [
"X"
],
"sender_address_id": "ABC123",
"receiver_address_id": "ABC124",
"pickup_time_earliest": "2012-01-06T04:00:00Z",
"pickup_time_latest": "2012-01-06T07:00:00Z",
"features": [
"HAND_UNLOAD"
],
"items": [
{
"quantity": 2,
"packaging": "PLT",
"length": 1200,
"width": 1200,
"height": 1200,
"weight": 1000000,
"characteristics": [
"DANGEROUS_GOODS"
]
}
]
}
# Call the API.
response = APIHelper(
PREFIX,
VERSION,
).post('/quote', body=body, validate=False)
print(body)
print(response)
# Check the API response code
> assert 200 <= response.status_code < 300
E assert 400 < 300
E + where 400 = <Response streamed [400 BAD REQUEST]>.status_code
tests/test_quotes.py:67: AssertionError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment