Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def template_test(schema_version, schema, data, is_valid):
"""
Test function to be used (imported) in final test file to run the tests
which are generated by `pytest_generate_tests` hook.
"""
# For debug purposes. When test fails, it will print stdout.
resolver = RefResolver.from_schema(schema, handlers={'http': remotes_handler})
debug_generator = _get_code_generator_class(schema_version)(schema, resolver=resolver)
print(debug_generator.global_state_code)
print(debug_generator.func_code)
# JSON schema test suits do not contain schema version.
# Our library needs to know that or it would use always the latest implementation.
if isinstance(schema, dict):
schema.setdefault('$schema', schema_version)
validate = compile(schema, handlers={'http': remotes_handler})
try:
result = validate(data)
print('Validate result:', result)
except JsonSchemaException:
if is_valid:
def template_test(schema_version, schema, data, is_valid):
"""
Test function to be used (imported) in final test file to run the tests
which are generated by `pytest_generate_tests` hook.
"""
# For debug purposes. When test fails, it will print stdout.
resolver = RefResolver.from_schema(schema, handlers={'http': remotes_handler})
debug_generator = _get_code_generator_class(schema_version)(schema, resolver=resolver)
print(debug_generator.global_state_code)
print(debug_generator.func_code)
# JSON schema test suits do not contain schema version.
# Our library needs to know that or it would use always the latest implementation.
if isinstance(schema, dict):
schema.setdefault('$schema', schema_version)
validate = compile(schema, handlers={'http': remotes_handler})
try:
result = validate(data)
print('Validate result:', result)
except JsonSchemaException:
if is_valid:
raise
else:
def __init__(self):
super(JSONSchemaValidator4Bb22Af046Fa8F08, self).__init__()
self._validator = fastjsonschema.compile(json.loads(
'''{
"properties": {
"response": {
"properties": {
"taskId": {},
"url": {
"description":
"",
"type": [
"string",
"null"
]
}
},
"type": [
"object",
def __init__(self):
super(JSONSchemaValidatorCd98780F4888A66D, self).__init__()
self._validator = fastjsonschema.compile(json.loads(
'''{
"properties": {
"response": {
"properties": {
"taskId": {},
"url": {
"description":
"",
"type": [
"string",
"null"
]
}
},
"type": [
"object",
def __init__(self):
super(JSONSchemaValidator17929Bc7465BB564, self).__init__()
self._validator = fastjsonschema.compile(json.loads(
'''{
"properties": {
"response": {
"properties": {
"taskId": {},
"url": {
"description":
"",
"type": [
"string",
"null"
]
}
},
"type": [
"object",
def __init__(self):
super(JSONSchemaValidatorA395Fae644Ca899C, self).__init__()
self._validator = fastjsonschema.compile(json.loads(
'''{
"properties": {
"response": {
"properties": {
"flowAnalysisId": {
"description":
"",
"type": [
"string",
"null"
]
},
"taskId": {
"description":
"",
"type": [
def __init__(self):
super(JSONSchemaValidator7Aa3Da9D4E098Ef2, self).__init__()
self._validator = fastjsonschema.compile(json.loads(
'''{
"properties": {
"response": {
"properties": {
"taskId": {},
"url": {
"description":
"",
"type": [
"string",
"null"
]
}
},
"type": [
"object",
def validate(self, request):
try:
self._validator(request)
except fastjsonschema.exceptions.JsonSchemaException as e:
raise MalformedRequest(
'{} is invalid. Reason: {}'.format(request, e.message)
)
def validate(self, request):
try:
self._validator(request)
except fastjsonschema.exceptions.JsonSchemaException as e:
raise MalformedRequest(
'{} is invalid. Reason: {}'.format(request, e.message)
)
def validate(self, request):
try:
self._validator(request)
except fastjsonschema.exceptions.JsonSchemaException as e:
raise MalformedRequest(
'{} is invalid. Reason: {}'.format(request, e.message)
)