Beispiel #1
0
    def test_resource_schema_invalid_schema_object(self):

        schema = {'a': 1}

        with assert_raises(Invalid) as e:
            resource_schema_validator(schema, {})

        assert e.exception.error.startswith(
            'Invalid Table Schema: ' +
            'Descriptor validation error: \'fields\' is a required property')
Beispiel #2
0
    def test_resource_schema_valid_schema_url(self):

        schema = 'https://example.com/schema.json'

        value = resource_schema_validator(schema, {})

        assert_equals(value, schema)
Beispiel #3
0
    def test_resource_schema_valid_schema_string(self):

        schema = '{"fields": [{"name": "longitude"}]}'

        value = resource_schema_validator(schema, {})

        assert_equals(value, schema)
Beispiel #4
0
    def test_resource_schema_valid_schema_object(self):

        schema = {'fields': [{'name': 'longitude'}]}

        value = resource_schema_validator(schema, {})

        assert_equals(value, json.dumps(schema))
Beispiel #5
0
    def test_resource_schema_none(self):

        schema = ''

        assert resource_schema_validator(schema, {}) is None