steps.api.then

Functions

status_code_validation(context, expected_http_status_code)

Validate that the response has the expected HTTP status code.

check_response_from_table(context)

Check that the response contains the expected key-value pairs from a table.

check_empty_response(context)

Check that the response body is empty (empty JSON object or array).

check_not_empty_response(context)

Check that the response body is not empty (has content).

response_match_defined_schema(context)

Validate that the response JSON matches the defined schema.

Module Contents

steps.api.then.status_code_validation(context, expected_http_status_code)[source]

Validate that the response has the expected HTTP status code.

Parameters:
  • context – The Behave context

  • expected_http_status_code – Expected HTTP status code as string

Raises:

MissingEndpoint – If 404 wasn’t expected but was received with the standard message

steps.api.then.check_response_from_table(context)[source]

Check that the response contains the expected key-value pairs from a table.

Expects a Gherkin table with ‘key’ and ‘value’ columns, and validates each key-value pair against the response JSON.

Parameters:

context – The Behave context containing a table of keys and values

steps.api.then.check_empty_response(context)[source]

Check that the response body is empty (empty JSON object or array).

Parameters:

context – The Behave context

steps.api.then.check_not_empty_response(context)[source]

Check that the response body is not empty (has content).

Parameters:

context – The Behave context

steps.api.then.response_match_defined_schema(context)[source]

Validate that the response JSON matches the defined schema.

Performs schema validation against the defined schema for the current endpoint, checking for various schema-related issues including default schemas, forbidden keywords, and data validation errors.

Parameters:

context – The Behave context