get_schema_url only works on object types now, so change some code to meet the new api
authorDiane Trout <diane@ghic.org>
Sat, 10 Jan 2015 00:40:40 +0000 (16:40 -0800)
committerDiane Trout <diane@ghic.org>
Sat, 10 Jan 2015 00:40:40 +0000 (16:40 -0800)
htsworkflow/submission/encoded.py
htsworkflow/submission/test/test_encoded.py

index 66cb62d3cc767773a05c7b3a8647a6e1ce2ae862..2dbdc4bb89d44fe85bd0c3b144b21080c4559739 100644 (file)
@@ -165,8 +165,9 @@ class ENCODED:
         self.contexts[None] = default context attributes added to any type
         self.contexts[type] = context attributes for this type.
         '''
+        obj_type = self.get_object_type(obj)
         context = {'@base': urljoin(default_base, obj['@id']),
-                   '@vocab': self.get_schema_url(obj)}
+                   '@vocab': self.get_schema_url(obj_type)}
         # add in defaults
         context.update(self.contexts[None])
         for t in obj['@type']:
index a1b22a02feca20e6552c2fc7c40068868134b02d..17b793bfe39e5240cf82c0d881d05bcc2f6c2d43 100644 (file)
@@ -110,7 +110,8 @@ class TestEncoded(TestCase):
         bio_base = encode.prepare_url(obj['biosample']['@id'])
 
         url = encode.prepare_url('/libraries/ENCLB044ZZZ/?format=json&embed=False')
-        schema_url = encode.get_schema_url(obj)
+        obj_type = encode.get_object_type(obj)
+        schema_url = encode.get_schema_url(obj_type)
         encode.add_jsonld_context(obj, url)
 
         self.assertEqual(obj['biosample']['@context']['@base'], bio_base)