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