Exemple #1
0
def test_from_file(config, filename):
    file_path = config.test_dir / filename
    client = Client.from_file(file_path)
    assert client.spec.info.title == "Test Spec"
Exemple #2
0
from pathlib import Path

from pyotr.client import Client

SPEC_PATH = Path(__file__).parent / "petstore.yaml"

client = Client.from_file(SPEC_PATH)

assert client.find_pets_by_status(status="available").payload == {
    "pets": [{
        "name": "Athena",
        "photoUrls": ["sdfsdfasdf", "asdasdasdasd"]
    }]
}
Exemple #3
0
def test_from_file_raises_exception_if_unknown_type(config):
    file_path = config.test_dir / "openapi.unknown"
    with pytest.raises(RuntimeError):
        Client.from_file(file_path)