[test] Import module instead of names
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 29 Mar 2017 09:51:51 +0200
changeset 2542 1c4456729955
parent 2532 a88deb387b2b
child 2543 891c2f852c5c
[test] Import module instead of names will be easier to use another function from this module.
test/test_hooks.py
--- a/test/test_hooks.py	Wed Mar 22 17:37:14 2017 +0100
+++ b/test/test_hooks.py	Wed Mar 29 09:51:51 2017 +0200
@@ -20,7 +20,7 @@
 from cubicweb import ValidationError
 from cubicweb.devtools.testlib import CubicWebTC
 
-from testutils import create_transfer_to_bdo, create_archive_unit, scheme_for_type
+import testutils
 
 
 class ValidationHooksTC(CubicWebTC):
@@ -35,7 +35,7 @@
             reuse_concept = reuse_scheme.add_concept(label=u'share-alike')
             cnx.commit()
 
-            bdo = create_transfer_to_bdo(cnx)
+            bdo = testutils.create_transfer_to_bdo(cnx)
             transfer = bdo.container[0]
             create('SEDAAccessRuleCodeListVersion',
                    seda_access_rule_code_list_version_from=transfer,
@@ -140,7 +140,7 @@
                                        ('seda_rule', 'SEDASeqAppraisalRuleRule'),
                                        ('seda_rule', 'SEDASeqAccessRuleRule'),
                                        ('seda_rule', 'SEDASeqDisseminationRuleRule')]):
-                scheme_for_type(cnx, rtype, etype)
+                testutils.scheme_for_type(cnx, rtype, etype)
             cnx.commit()
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
             cnx.commit()
@@ -160,7 +160,7 @@
         """
         with self.admin_access.client_cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
-            unit, unit_alt, unit_alt_seq = create_archive_unit(transfer)
+            unit, unit_alt, unit_alt_seq = testutils.create_archive_unit(transfer)
             version_of = cnx.create_entity('SEDAIsVersionOf', seda_is_version_of=unit_alt_seq)
             alt2 = cnx.create_entity('SEDAAltIsVersionOfArchiveUnitRefId',
                                      reverse_seda_alt_is_version_of_archive_unit_ref_id=version_of)
@@ -175,7 +175,7 @@
     def test_base(self):
         with self.admin_access.repo_cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'diagnosis testing')
-            unit, unit_alt, unit_alt_seq = create_archive_unit(transfer)
+            unit, unit_alt, unit_alt_seq = testutils.create_archive_unit(transfer)
             access_rule = cnx.create_entity('SEDAAccessRule', seda_access_rule=unit_alt_seq)
             cnx.commit()