Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_openapi_version_invalid_version(self, version):
message = "Not a valid OpenAPI version number:"
with pytest.raises(APISpecError, match=message):
utils.OpenAPIVersion(version)
@pytest.mark.parametrize("version", ("3.0.1", utils.OpenAPIVersion("3.0.1")))
def test_openapi_version_string_or_openapi_version_param(self, version):
assert utils.OpenAPIVersion(version) == utils.OpenAPIVersion("3.0.1")
def test_openapi_version_string_or_openapi_version_param(self, version):
assert utils.OpenAPIVersion(version) == utils.OpenAPIVersion("3.0.1")
def test_openapi_version_digits(self):
ver = utils.OpenAPIVersion("3.0.1")
assert ver.major == 3
assert ver.minor == 0
assert ver.patch == 1
assert ver.vstring == "3.0.1"
assert str(ver) == "3.0.1"
'name': 'Request Schemas',
'tags': []
},
],
'x-ignoredHeaderParameters': [
'User-Agent',
'X-Test-Header',
],
'security': [{
'BearerAuth': []
}]
}
SPEC = apispec.APISpec("Checkmk REST API",
"0.3.2",
apispec.utils.OpenAPIVersion("3.0.2"),
plugins=[
plugins.ValueTypedDictMarshmallowPlugin(),
apispec_oneofschema.MarshmallowPlugin(),
],
**OPTIONS)
SPEC.components.security_scheme(
'BearerAuth',
{
'type': 'http',
'scheme': 'bearer',
'in': 'header',
'description': 'The format of the header-value is "Bearer $automation_user '
'$automation_user_password"\n\nExample: `Bearer hansdampf miezekatze123`',
'bearerFormat': 'username password',
'x-bearerInfoFunc': 'cmk.gui.wsgi.auth.bearer_auth',
},
def __init__(self, openapi_version, schema_name_resolver, spec):
self.openapi_version = OpenAPIVersion(openapi_version)
self.schema_name_resolver = schema_name_resolver
self.spec = spec
self.init_attribute_functions()
# Schema references
self.refs = {}