def test_dry_run_asgi(fastapi_app): called = False def check(response, case): nonlocal called called = True # When the user passes `dry_run=True` schema = oas_loaders.from_asgi("/openapi.json", fastapi_app) execute(schema, checks=(check,), dry_run=True) # Then no requests should be sent & no responses checked assert not called
def schema(fastapi_app): return from_asgi("/openapi.json", fastapi_app)
def test_asgi_interactions(fastapi_app): schema = oas_loaders.from_asgi("/openapi.json", fastapi_app) init, *ev, finished = from_schema(schema, store_interactions=True).execute() interaction = ev[1].result.interactions[0] assert interaction.status == Status.success assert interaction.request.uri == "http://testserver/users"
def test_openapi_asgi_loader(fastapi_app, run_asgi_test): # When an ASGI app is loaded via `from_asgi` schema = loaders.from_asgi("/openapi.json", fastapi_app) strategy = schema["/users"]["GET"].as_strategy() # Then it should successfully make calls via `call_asgi` run_asgi_test(strategy)