1
0
mirror of https://github.com/gsi-upm/senpy synced 2024-11-22 08:12:27 +00:00

Fixed expansion of "plugins"

Closes #26

There was no need to add @list, and it was causing JSON-LD to expand the
URI of 'plugins'
This commit is contained in:
J. Fernando Sánchez 2017-04-07 16:24:28 +02:00
parent 1302b0b93c
commit d3d05b3218
3 changed files with 14 additions and 10 deletions

View File

@ -37,9 +37,6 @@
"@type": "@id", "@type": "@id",
"@container": "@set" "@container": "@set"
}, },
"plugins": {
"@container": "@list"
},
"options": { "options": {
"@container": "@set" "@container": "@set"
}, },

View File

@ -10,8 +10,6 @@
"items": { "items": {
"$ref": "plugin.json" "$ref": "plugin.json"
} }
},
"@type": {
} }
} }
} }

View File

@ -109,13 +109,15 @@ class ModelsTest(TestCase):
} }
}}) }})
c = p.jsonld() c = p.jsonld()
assert "info" not in c assert '@type' in c
assert "repo" not in c assert c['@type'] == 'plugin'
assert "extra_params" in c assert 'info' not in c
logging.debug("Framed:") assert 'repo' not in c
assert 'extra_params' in c
logging.debug('Framed:')
logging.debug(c) logging.debug(c)
p.validate() p.validate()
assert "es" in c['extra_params']['none']['options'] assert 'es' in c['extra_params']['none']['options']
assert isinstance(c['extra_params']['none']['options'], list) assert isinstance(c['extra_params']['none']['options'], list)
def test_str(self): def test_str(self):
@ -158,6 +160,13 @@ class ModelsTest(TestCase):
g = rdflib.Graph().parse(data=t, format='turtle') g = rdflib.Graph().parse(data=t, format='turtle')
assert len(g) == len(triples) assert len(g) == len(triples)
def test_plugin_list(self):
"""The plugin list should be of type \"plugins\""""
plugs = Plugins()
c = plugs.jsonld()
assert '@type' in c
assert c['@type'] == 'plugins'
def test_single_plugin(self): def test_single_plugin(self):
"""A response with a single plugin should still return a list""" """A response with a single plugin should still return a list"""
plugs = Plugins() plugs = Plugins()