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_warning(swagger_20):
example = {"name": "John"}
endpoint = make_endpoint(swagger_20, query={"example": example})
with pytest.warns(None) as record:
assert list(get_examples(endpoint)) == [Case(endpoint, query=example)]
assert not record
def test_get_examples(name, swagger_20):
example = {"name": "John"}
endpoint = make_endpoint(
swagger_20,
**{
name: {
"required": ["name"],
"type": "object",
"additionalProperties": False,
"properties": {"name": {"type": "string"}},
"example": example,
}
},
)
assert list(get_examples(endpoint)) == [Case(endpoint, **{name: example})]
def test_no_body_in_get(swagger_20):
endpoint = Endpoint(
path="/api/success",
method="GET",
definition={},
schema=swagger_20,
query={
"required": ["name"],
"type": "object",
"additionalProperties": False,
"properties": {"name": {"type": "string"}},
"example": {"name": "John"},
},
)
assert list(get_examples(endpoint))[0].body is None