Skip to content

Commit

Permalink
100% coverage for the managers.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Aug 24, 2018
1 parent 0b39928 commit 3920d0d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/zope/securitypolicy/principalpermission.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def getPrincipalsAndPermissions(self):
# simpler.
try:
from zope.testing.cleanup import addCleanUp
except ImportError:
except ImportError: # pragma: no cover
pass
else:
addCleanUp(principalPermissionManager._clear)
Expand Down
2 changes: 1 addition & 1 deletion src/zope/securitypolicy/principalrole.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def getPrincipalsAndRoles(self):
# simpler.
try:
from zope.testing.cleanup import addCleanUp
except ImportError:
except ImportError: # pragma: no cover
pass
else:
addCleanUp(principalRoleManager._clear)
Expand Down
2 changes: 1 addition & 1 deletion src/zope/securitypolicy/rolepermission.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def getRolesAndPermissions(self):
# simpler.
try:
from zope.testing.cleanup import addCleanUp
except ImportError:
except ImportError: # pragma: no cover
pass
else:
addCleanUp(rolePermissionManager._clear)
Expand Down
2 changes: 2 additions & 0 deletions src/zope/securitypolicy/tests/test_rolepermissionmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def testRolePermission(self):
[(role, Allow)])
self.assertEqual(manager.getPermissionsForRole(role),
[(permission, Allow)])
self.assertEqual(manager.getRolesAndPermissions(),
[('APerm', 'ARole', Allow)])

def testManyPermissionsOneRole(self):
perm1 = definePermission('Perm One', 'P1').id
Expand Down
12 changes: 12 additions & 0 deletions src/zope/securitypolicy/tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,15 @@ def testPickleUnpickle(self):
newAllow = pickle.loads(s)

self.assertIs(newAllow, Allow)

def testDescription(self):
self.assertEqual("Explicit allow setting for permissions",
Allow.getDescription())

def testName(self):
self.assertEqual("Allow",
Allow.getName())

def testStr(self):
self.assertEqual("PermissionSetting: Allow",
str(Allow))

0 comments on commit 3920d0d

Please sign in to comment.