Response Assertions

tests.helpers.response_assertions.assert_get_metadata(response, case, url_contains)[source]

Assert standard GET response metadata from a parametrized test case.

Builds the expected-values dict from a test case (valid or invalid) and delegates to assert_http_response, keeping the metadata key names in one place.

Parameters:
  • response – APIResponse returned by the client.

  • case – Parametrized test data dict (expects status_code, exp_max_elp_secs, exp_get_req_method, exp_content_type, reason).

  • url_contains – Substring expected in the response URL.

tests.helpers.response_assertions.assert_http_response(response, exp_val)[source]

Assert common HTTP response properties.

Parameters:
  • response – The HTTP response object to validate.

  • exp_val – A dictionary containing expected values: - ‘exp_req_method’: Expected HTTP method (e.g., ‘GET’). - ‘exp_status_code’: Expected HTTP status code (e.g., 200). - ‘exp_content_type’: Expected content type substring (e.g., ‘application/json’). - ‘exp_max_elp_seconds’: Maximum allowed response time in seconds (e.g., 2). - ‘exp_url_contains’: Substring that should be present in the response URL (e.g., movie ID).

Raises:

AssertionError – If any validation fails.