Exemple #1
0
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)
Exemple #2
0
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)
Exemple #3
0
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)
Exemple #4
0
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)
Exemple #5
0
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)
Exemple #6
0
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)
Exemple #7
0
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)
Exemple #8
0
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)