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

Set plugin list as a @set and fixed test case

It turns out setting "plugins" as a @list in the context causes the
"plugins" property to expand to its full name.
Removing the type causes a regression of #17, which I initially missed
because the test in #17 was wrong.

Closes #26
This commit is contained in:
J. Fernando Sánchez 2017-04-10 17:24:39 +02:00
parent d3d05b3218
commit 14c86ec38c
2 changed files with 7 additions and 5 deletions

View File

@ -40,6 +40,9 @@
"options": { "options": {
"@container": "@set" "@container": "@set"
}, },
"plugins": {
"@container": "@set"
},
"prov:wasGeneratedBy": { "prov:wasGeneratedBy": {
"@type": "@id" "@type": "@id"
}, },

View File

@ -170,11 +170,10 @@ class ModelsTest(TestCase):
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()
for i in range(10): p = Plugin({'id': str(0),
p = Plugin({'id': str(i), 'version': 0,
'version': 0, 'description': 'dummy'})
'description': 'dummy'}) plugs.plugins.append(p)
plugs.plugins.append(p)
assert isinstance(plugs.plugins, list) assert isinstance(plugs.plugins, list)
js = plugs.jsonld() js = plugs.jsonld()
assert isinstance(js['plugins'], list) assert isinstance(js['plugins'], list)