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): ...@@ -140,17 +140,17 @@ class SecurityTestCase(ERP5TypeTestCase):
newSecurityManager(None, user.__of__(uf)) newSecurityManager(None, user.__of__(uf))
# Permission methods # Permission methods
failIfUserCanViewDocument = AssertNoPermissionMethod( failIfUserCanViewDocument = assertUserCanNotViewDocument = AssertNoPermissionMethod(
Permissions.View) Permissions.View)
failIfUserCanAccessDocument = AssertNoPermissionMethod( failIfUserCanAccessDocument = assertUserCanNotAccessDocument = AssertNoPermissionMethod(
Permissions.AccessContentsInformation) Permissions.AccessContentsInformation)
failIfUserCanModifyDocument = AssertNoPermissionMethod( failIfUserCanModifyDocument = assertUserCanNotModifyDocument = AssertNoPermissionMethod(
Permissions.ModifyPortalContent) Permissions.ModifyPortalContent)
failIfUserCanAddDocument = AssertNoPermissionMethod( failIfUserCanAddDocument = assertUserCanNotAddDocument = AssertNoPermissionMethod(
Permissions.AddPortalContent) Permissions.AddPortalContent)
failIfUserCanChangeLocalRoles = AssertNoPermissionMethod( failIfUserCanChangeLocalRoles = assertUserCanNotChangeLocalRoles = AssertNoPermissionMethod(
Permissions.ChangeLocalRoles) Permissions.ChangeLocalRoles)
failIfUserCanDeleteDocument = AssertNoPermissionMethod( failIfUserCanDeleteDocument = assertUserCanNotDeleteDocument = AssertNoPermissionMethod(
Permissions.DeleteObjects) Permissions.DeleteObjects)
def failIfUserHavePermissionOnDocument(self, permission_name, username, document): def failIfUserHavePermissionOnDocument(self, permission_name, username, document):
...@@ -198,6 +198,8 @@ class SecurityTestCase(ERP5TypeTestCase): ...@@ -198,6 +198,8 @@ class SecurityTestCase(ERP5TypeTestCase):
finally: finally:
setSecurityManager(sm) setSecurityManager(sm)
assertUserCanNotPassWorkflowTransition = failIfUserCanPassWorkflowTransition
def failUnlessUserCanPassWorkflowTransition(self, username, def failUnlessUserCanPassWorkflowTransition(self, username,
transition, document): transition, document):
"""Fails unless the user can pass the workflow transition on the document.""" """Fails unless the user can pass the workflow transition on the document."""
...@@ -292,6 +294,8 @@ class SecurityTestCase(ERP5TypeTestCase): ...@@ -292,6 +294,8 @@ class SecurityTestCase(ERP5TypeTestCase):
finally: finally:
setSecurityManager(sm) setSecurityManager(sm)
assertUserDoesNotHaveRoleOnDocument = failIfUserHaveRoleOnDocument
def failUnlessUserHaveRoleOnDocument(self, username, role, document): def failUnlessUserHaveRoleOnDocument(self, username, role, document):
"""Fails if the user does not have the role on the document.""" """Fails if the user does not have the role on the document."""
sm = getSecurityManager() 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