[test] Add support for extra kwargs to scheme_for_rtype
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 31 Mar 2017 14:55:09 +0200
changeset 2591 d33d90d4daad
parent 2590 54ded6ab2e4f
child 2592 8477512718c8
[test] Add support for extra kwargs to scheme_for_rtype This is useful for saem to insert its naa without redefining the whole function.
cubicweb_seda/testutils.py
--- a/cubicweb_seda/testutils.py	Fri Mar 31 14:54:19 2017 +0200
+++ b/cubicweb_seda/testutils.py	Fri Mar 31 14:55:09 2017 +0200
@@ -111,8 +111,11 @@
                     {'cs': scheme.eid, 'et': etype})
 
 
-def scheme_for_type(cnx, rtype, etype, *concept_labels):
-    scheme = cnx.create_entity('ConceptScheme', title=u'{0}/{1} vocabulary'.format(rtype, etype))
+# extra kwargs useful for client lib (e.g. saem)
+def scheme_for_type(cnx, rtype, etype, *concept_labels, **kwargs):
+    """Create a concept scheme an map it to give rtype and optional etype."""
+    scheme = cnx.create_entity('ConceptScheme', title=u'{0}/{1} vocabulary'.format(rtype, etype),
+                               **kwargs)
     map_cs_to_type(scheme, rtype, etype)
     for label in concept_labels:
         scheme.add_concept(label)