def test_file_output_invalid(): payload = [{ 'modified': '2018-02-07T17:27:21+00:00' }] schema_uri = validators.schema_uri("output", "file-list.json") schema, resolver = validators._resolve_schema(schema_uri) with pytest.raises(jsonschema.exceptions.ValidationError): validators._validate_json(payload, schema, resolver)
def test_file_output_valid(): payload = [{ 'modified': '2018-02-07T17:27:21+00:00', 'size': 10 }] schema_uri = validators.schema_uri("output", "file-list.json") schema, resolver = validators._resolve_schema(schema_uri) validators._validate_json(payload, schema, resolver)
def test_example_payload_valid(schema_type, schema_name): example_data = load_example_data(schema_type, schema_name) if example_data is None: if FAIL_ON_MISSING_EXAMPLE: pytest.fail('Missing example file for: {0}/{1}.json'.format(schema_type, schema_name)) else: schema_uri = validators.schema_uri(schema_type, '{0}.json'.format(schema_name)) schema, resolver = validators._resolve_schema(schema_uri) validators._validate_json(example_data, schema, resolver)
def test_example_payload_valid(schema_type, schema_name): example_data = load_example_data(schema_type, schema_name) if example_data is None: if FAIL_ON_MISSING_EXAMPLE: pytest.fail('Missing example file for: {0}/{1}.json'.format( schema_type, schema_name)) else: schema_uri = validators.schema_uri(schema_type, '{0}.json'.format(schema_name)) schema, resolver = validators._resolve_schema(schema_uri) validators._validate_json(example_data, schema, resolver)
def test_payload(): payload = { 'files': [], 'group': 'unknown', 'label': 'SciTran/Testing', 'public': False, 'permissions': [], 'extra_params': 'testtest' } schema_uri = validators.schema_uri("input", "project.json") schema, resolver = validators._resolve_schema(schema_uri) with pytest.raises(jsonschema.exceptions.ValidationError): validators._validate_json(payload, schema, resolver)
def test_file_output_invalid(): payload = [{'modified': '2018-02-07T17:27:21+00:00'}] schema_uri = validators.schema_uri("output", "file-list.json") schema, resolver = validators._resolve_schema(schema_uri) with pytest.raises(jsonschema.exceptions.ValidationError): validators._validate_json(payload, schema, resolver)
def test_file_output_valid(): payload = [{'modified': '2018-02-07T17:27:21+00:00', 'size': 10}] schema_uri = validators.schema_uri("output", "file-list.json") schema, resolver = validators._resolve_schema(schema_uri) validators._validate_json(payload, schema, resolver)