Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_response_schema_conformance_swagger(swagger_20, content, definition):
response = make_response(content)
case = make_case(swagger_20, definition)
assert response_schema_conformance(response, case) is None
def test_response_schema_conformance_invalid_swagger(swagger_20, content, definition):
response = make_response(content)
case = make_case(swagger_20, definition)
with pytest.raises(AssertionError):
response_schema_conformance(response, case)
def test_response_conformance_text(args):
app, kwargs = args
# When endpoint returns a response that is not JSON
# And "response_schema_conformance" is specified
results = execute(**kwargs, checks=(response_schema_conformance,), hypothesis_options={"max_examples": 1})
# Then the check should be ignored if the response headers are not application/json
assert not results.has_failures
assert not results.has_errors
def test_response_schema_conformance_openapi(openapi_30, content, definition):
response = make_response(content)
case = make_case(openapi_30, definition)
assert response_schema_conformance(response, case) is None
def test_response_schema_conformance_invalid_openapi(openapi_30, content, definition):
response = make_response(content)
case = make_case(openapi_30, definition)
with pytest.raises(AssertionError):
response_schema_conformance(response, case)