How to use the schemathesis._hypothesis.get_examples function in schemathesis

To help you get started, we’ve selected a few schemathesis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kiwicom / schemathesis / test / test_hypothesis.py View on Github external
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
github kiwicom / schemathesis / test / test_hypothesis.py View on Github external
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})]
github kiwicom / schemathesis / test / test_hypothesis.py View on Github external
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