コード例 #1
0
def test_server_from_file_raises_exception_if_unknown_type(config):
    file_path = config.test_dir / "openapi.unknown"
    with pytest.raises(RuntimeError):
        Application.from_file(file_path)
コード例 #2
0
from pathlib import Path

from pyotr.server import Application

SPEC_PATH = Path(__file__).parent.parent / "petstore.yaml"
ENDPOINTS_MODULE = "examples.server.pets"

app = Application.from_file(SPEC_PATH, module=ENDPOINTS_MODULE, debug=True)
コード例 #3
0
def test_server_from_file(config, filename):
    file_path = config.test_dir / filename
    app = Application.from_file(file_path, module=config.endpoint_base)
    assert app.spec.info.title == "Test Spec"