[PATCH 1 of 3 seda] [test] Import module instead of names

Sylvain Thenault sylvain.thenault at logilab.fr
Wed Mar 29 11:11:09 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1490773911 -7200
#      Wed Mar 29 09:51:51 2017 +0200
# Node ID cb9c3c2a559c7c8676c55b5df626a05306619335
# Parent  02f4b849a80fbceef658f327c5799b549d4c4562
[test] Import module instead of names

will be easier to use another function from this module.

diff --git a/test/test_hooks.py b/test/test_hooks.py
--- a/test/test_hooks.py
+++ b/test/test_hooks.py
@@ -18,11 +18,11 @@
 from itertools import chain, repeat
 
 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):
 
     def test_ref_non_rule_constraints(self):
@@ -33,11 +33,11 @@ class ValidationHooksTC(CubicWebTC):
             access_concept = access_scheme.add_concept(label=u'anyone')
             reuse_scheme = create('ConceptScheme', title=u'reuse')
             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,
                    seda_access_rule_code_list_version_to=access_scheme)
             create('SEDAReuseRuleCodeListVersion',
@@ -138,11 +138,11 @@ class SetDefaultHooksTC(CubicWebTC):
                                           repeat(None)),
                                       [('seda_algorithm', 'SEDABinaryDataObject'),
                                        ('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()
 
             self.assertTrue(transfer.reverse_seda_file_format_code_list_version_from)
@@ -158,11 +158,11 @@ class SetDefaultHooksTC(CubicWebTC):
         should always be 1 (by default any card is allowed since in may be used in the context of
         'main' reference).
         """
         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)
             do_ref = cnx.create_entity('SEDADataObjectReference', seda_data_object_reference=alt2)
             cnx.commit()
@@ -173,11 +173,11 @@ class SetDefaultHooksTC(CubicWebTC):
 class CheckProfileTC(CubicWebTC):
 
     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()
 
             with self.assertRaises(ValidationError):
                 transfer.cw_set(simplified_profile=True)


More information about the saem-devel mailing list