Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"method, path", ((schemathesis.from_path, SIMPLE_PATH), (schemathesis.from_uri, f"file://{SIMPLE_PATH}"))
)
def test_alternative_constructors(simple_schema, method, path):
assert method(path).raw_schema == simple_schema
def test_uri_loader(app_schema, app, schema_url):
# Each loader method should read the specified schema correctly
assert schemathesis.from_uri(schema_url).raw_schema == app_schema
def test_uri_loader_custom_kwargs(app, schema_url):
# All custom kwargs are passed to `requests.get`
schemathesis.from_uri(schema_url, verify=False, headers={"X-Test": "foo"})
request = app["schema_requests"][0]
assert request.headers["X-Test"] == "foo"
assert request.headers["User-Agent"] == USER_AGENT
def test_base_url(base_url, schema_url):
schema = schemathesis.from_uri(schema_url)
assert schema.base_url == base_url
def test_base_url_override(schema_url, url):
schema = schemathesis.from_uri(schema_url, base_url=url)
endpoint = next(schema.get_all_endpoints())
assert endpoint.base_url == "http://example.com"