示例#1
0
def test_examples_validity(schema, openapi3_base_url):
    endpoint = next(schema.get_all_endpoints())
    strategy = get_strategies_from_examples(endpoint, "examples")[0]

    @given(case=strategy)
    def test(case):
        # Generated examples should have valid parameters
        # E.g. headers should be latin-1 encodable
        case.call(base_url=openapi3_base_url)
示例#2
0
def test_get_strategies_from_examples(operation):
    strategies = examples.get_strategies_from_examples(operation, "examples")

    assert len(strategies) == 3
    assert all(strategy is not None for strategy in strategies)
def test_get_strategies_from_examples(endpoint):
    strategies = examples.get_strategies_from_examples(endpoint, "examples")

    assert len(strategies) == 3
    assert all(strategy is not None for strategy in strategies)