Commit 1266c706 authored by Jérome Perrin's avatar Jérome Perrin

SecurityTestCase: generate assertUserCanNot... methods

the "failIf..." naming scheme is deprecated in unittest, we should at
least have new-style named methods
parent b7b5f217
Pipeline #10205 failed with stage
in 0 seconds
......@@ -140,17 +140,17 @@ class SecurityTestCase(ERP5TypeTestCase):
newSecurityManager(None, user.__of__(uf))
# Permission methods
failIfUserCanViewDocument = AssertNoPermissionMethod(
failIfUserCanViewDocument = assertUserCanNotViewDocument = AssertNoPermissionMethod(
Permissions.View)
failIfUserCanAccessDocument = AssertNoPermissionMethod(
failIfUserCanAccessDocument = assertUserCanNotAccessDocument = AssertNoPermissionMethod(
Permissions.AccessContentsInformation)
failIfUserCanModifyDocument = AssertNoPermissionMethod(
failIfUserCanModifyDocument = assertUserCanNotModifyDocument = AssertNoPermissionMethod(
Permissions.ModifyPortalContent)
failIfUserCanAddDocument = AssertNoPermissionMethod(
failIfUserCanAddDocument = assertUserCanNotAddDocument = AssertNoPermissionMethod(
Permissions.AddPortalContent)
failIfUserCanChangeLocalRoles = AssertNoPermissionMethod(
failIfUserCanChangeLocalRoles = assertUserCanNotChangeLocalRoles = AssertNoPermissionMethod(
Permissions.ChangeLocalRoles)
failIfUserCanDeleteDocument = AssertNoPermissionMethod(
failIfUserCanDeleteDocument = assertUserCanNotDeleteDocument = AssertNoPermissionMethod(
Permissions.DeleteObjects)
def failIfUserHavePermissionOnDocument(self, permission_name, username, document):
......@@ -198,6 +198,8 @@ class SecurityTestCase(ERP5TypeTestCase):
finally:
setSecurityManager(sm)
assertUserCanNotPassWorkflowTransition = failIfUserCanPassWorkflowTransition
def failUnlessUserCanPassWorkflowTransition(self, username,
transition, document):
"""Fails unless the user can pass the workflow transition on the document."""
......@@ -292,6 +294,8 @@ class SecurityTestCase(ERP5TypeTestCase):
finally:
setSecurityManager(sm)
assertUserDoesNotHaveRoleOnDocument = failIfUserHaveRoleOnDocument
def failUnlessUserHaveRoleOnDocument(self, username, role, document):
"""Fails if the user does not have the role on the document."""
sm = getSecurityManager()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment