Skip to content

Commit

Permalink
tests: adds test for nested allOf
Browse files Browse the repository at this point in the history
  • Loading branch information
Glignos authored and lnielsen committed Aug 28, 2020
1 parent ae9ee80 commit 8776586
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/test_invenio_jsonschemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
InvenioJSONSchemasUI
from invenio_jsonschemas.config import JSONSCHEMAS_URL_SCHEME
from invenio_jsonschemas.errors import JSONSchemaDuplicate, JSONSchemaNotFound
from invenio_jsonschemas.utils import resolve_schema


def test_version():
Expand Down Expand Up @@ -416,3 +417,41 @@ def test_whitelisting_entry_points(app, pkg_factory, mock_entry_points,
for schema in entries[name].keys():
expected_schemas.add(schema)
assert set(ext.list_schemas()) == expected_schemas


def test_resolve_schema():
"""Test case for nested allOf and its resolving."""
test_schema = {
"$schema": "http://json-schema.org/schema#",
"id": "http://localhost:5000/schemas/biology/test.json",
"allOf": [
{
"type": "object",
"properties": {
"species": {
"type": "string"
}
}
},
{
"allOf": [
{
"type": "object",
"properties": {
"species_nested": {
"type": "string"
}
}
}
]
}
]
}
resolved_schema = {
'$schema': 'http://json-schema.org/schema#',
'id': 'http://localhost:5000/schemas/biology/test.json',
'properties': {
'species': {'type': 'string'},
'species_nested': {'type': 'string'}},
'type': 'object'}
assert resolve_schema(test_schema) == resolved_schema

0 comments on commit 8776586

Please sign in to comment.