Skip to content

Commit

Permalink
fix(tests): use an existing permission
Browse files Browse the repository at this point in the history
  • Loading branch information
gforcada committed Apr 28, 2024
1 parent 3376ab1 commit e342408
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/plone/api/tests/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,14 +530,15 @@ def test_adopt_user_different_username(self):

def test_roles_restored_after_exception(self):
"""Tests that roles are restored after an exception."""
self.assertFalse(api.user.has_permission("Manage portal content"))
permission = "Manage properties"
self.assertFalse(api.user.has_permission(permission))
try:
with api.env.adopt_roles(["Manager"]):
self.assertTrue(api.user.has_permission("Manage portal content"))
self.assertTrue(api.user.has_permission(permission))
raise TestException("Test exception")
except TestException:
pass
self.assertFalse(api.user.has_permission("Manage portal content"))
self.assertFalse(api.user.has_permission(permission))

def test_user_restored_after_exception(self):
"""Tests that roles are restored after an exception."""
Expand Down

0 comments on commit e342408

Please sign in to comment.