[PATCH 4 of 4 saem_ref] [test] Set archival role to "deposit" for the other OU in security tests

Denis Laxalde denis.laxalde at logilab.fr
Fri Apr 13 14:35:10 CEST 2018

# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1523609680 -7200
#      Fri Apr 13 10:54:40 2018 +0200
# Node ID 59f3a1f0c9a90606938c1fed9e649829531ccde7
# Parent  a65281f047d17567eb836c7193817555453bd302
# Available At http://hg.logilab.org/review/cubes/saem_ref
#              hg pull http://hg.logilab.org/review/cubes/saem_ref -r 59f3a1f0c9a9
[test] Set archival role to "deposit" for the other OU in security tests

There's a 'S archival_role R, R name "deposit"' RQL constraint on
"use_profile" relation which we are trying to insert in
test_create_update_organizationunit_in_own_organization. The previous
data did not fulfill this constraint. This is not a problem in most
cases because we should get into an Unauthorized error first but it
appears that the validation check might occur before permissions check
sometimes (it occurred in CI environment, when running all tests; I
could not reproduce locally).

diff --git a/test/test_security.py b/test/test_security.py
--- a/test/test_security.py
+++ b/test/test_security.py
@@ -178,7 +178,7 @@ class NonManagerUserTC(CubicWebTC):
         with self.admin_access.cnx() as cnx:
             other_authority = testutils.authority_with_naa(cnx, name=u'other authority')
             other_unit = testutils.organization_unit(
-                cnx, u'arch', archival_roles=[u'archival'], authority=other_authority)
+                cnx, u'arch', archival_roles=[u'deposit'], authority=other_authority)
             profile = testutils.setup_profile(cnx)
             scheme = testutils.scheme_for_type(cnx, u'seda_keyword_type_to', None)

More information about the saem-devel mailing list