[PATCH 3 of 3 saem] [test] Update test to follow changes in the seda cube

Sylvain Thenault sylvain.thenault at logilab.fr
Wed May 10 10:13:55 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1493299549 -7200
#      Thu Apr 27 15:25:49 2017 +0200
# Node ID 7d439b32ecfb03a347708f3c4487b5c2f11bd0f1
# Parent  4e0c6cd1ebe5967795e210573c1058fa29f559c1
# Available At http://hg.logilab.org/review/cubes/saem_ref
#              hg pull http://hg.logilab.org/review/cubes/saem_ref -r 7d439b32ecfb
[test] Update test to follow changes in the seda cube

9016f1f0fe60 forbid managers to edit entities within a profile once it's
published. Reorder the test case to test the `use_profile` relation last, since
it requires profiles to be published.

diff --git a/test/unittest_hooks.py b/test/unittest_hooks.py
--- a/test/unittest_hooks.py
+++ b/test/unittest_hooks.py
@@ -92,27 +92,18 @@ class SAEMRefHooksTC(CubicWebTC):
         with self.admin_access.repo_cnx() as cnx:
             scheme = testutils.scheme_for_type(cnx, 'seda_rule', 'SEDASeqAccessRuleRule', u'AR038')
             transfer = testutils.setup_profile(cnx)
             unit, unit_alt, unit_alt_seq = testutils.create_archive_unit(transfer)
             cnx.commit()
-            transfer.cw_adapt_to('IWorkflowable').fire_transition('publish')
             transfer.cw_set(modification_date=YESTERDAY)
             cnx.commit()
 
             # edit composite children
             unit_alt_seq.reverse_seda_title[0].cw_set(title=u'archive name')
             cnx.commit()
             self.assertMDNow(transfer)
             self.resetMD(cnx, transfer)
-            # edit link from root to an entity which is not part of the container
-            # XXX that shouldn't change anything for this special relation
-            agent = testutils.organization_unit(
-                cnx, u'marcel', archival_roles=['deposit'])
-            transfer.cw_set(reverse_use_profile=agent)
-            cnx.commit()
-            self.assertMDNow(transfer)
-            self.resetMD(cnx, transfer)
             # edit relation to a composite children
             code = scheme.reverse_in_scheme[0]
             rule_seq = cnx.create_entity('SEDASeqAccessRuleRule',
                                          reverse_seda_start_date=cnx.create_entity('SEDAStartDate'),
                                          seda_rule=code)
@@ -129,10 +120,20 @@ class SAEMRefHooksTC(CubicWebTC):
             self.resetMD(cnx, transfer)
             # deletion of a composite children
             rule.cw_delete()
             cnx.commit()
             self.assertMDNow(transfer)
+            transfer.cw_adapt_to('IWorkflowable').fire_transition('publish')
+            cnx.commit()
+            self.resetMD(cnx, transfer)
+            # edit link from root to an entity which is not part of the container
+            # XXX that shouldn't change anything for this special relation
+            agent = testutils.organization_unit(
+                cnx, u'marcel', archival_roles=['deposit'])
+            transfer.cw_set(reverse_use_profile=agent)
+            cnx.commit()
+            self.assertMDNow(transfer)
             self.resetMD(cnx, transfer)
 
     def test_externaluri_to_concept(self):
         with self.admin_access.repo_cnx() as cnx:
             # create some authority record and related objects


More information about the saem-devel mailing list