plone.api/fix_tests: enhance test coverage
Alexander Loechel <jenkins-z4DKO/[email protected]> Mon, 31 Jul 2017 14:41:30 -0700 (PDT)
| Newsgroups | gmane.comp.web.zope.plone.cvs |
|---|---|
| Message-ID | <[email protected]> |
Repository: plone.api Branch: refs/heads/fix_tests Date: 2017-07-31T23:41:16+02:00 Author: Alexander Loechel (loechel) <[email protected]> Commit: https://github.com/plone/plone.api/commit/fd10e4f12269335362f3c011465fa3c0cd77896c enhance test coverage Files changed: M src/plone/api/tests/test_user.py diff --git a/src/plone/api/tests/test_user.py b/src/plone/api/tests/test_user.py index 0f49ef2..6a48762 100644 --- a/src/plone/api/tests/test_user.py +++ b/src/plone/api/tests/test_user.py @@ -609,6 +609,14 @@ def test_has_permission_context(self): ), ) + self.assertTrue( + api.user.has_permission( + 'View', + user=None, + obj=folder, + ), + ) + def test_grant_roles(self): """Test granting a couple of roles.""" @@ -656,6 +664,10 @@ def test_grant_roles_username_and_user(self): with self.assertRaises(MissingParameterError): api.user.grant_roles(username=user) + from plone.api.exc import InvalidParameterError + with self.assertRaises(InvalidParameterError): + api.user.grant_roles(username='chuck', roles=('Authenticated')) + def test_grant_roles_anonymous(self): """Test granting Anonymous role.""" @@ -765,6 +777,17 @@ def test_revoke_roles_no_parameters(self): with self.assertRaises(MissingParameterError): api.user.revoke_roles() + def test_revoke_roles_username(self): + """Test revoke roles for username.""" + api.user.create( + username='chuck', + email='chuck-69hlKehBS/[email protected]', + password='secret', + ) + from plone.api.exc import InvalidParameterError + with self.assertRaises(InvalidParameterError): + api.user.revoke_roles(username='chuck', roles=['Authenticated', ]) + @unittest.skip('Getting the Anonymous user does not work like this.') def test_revoke_roles_from_anonymous(self): """Test revoking roles from an Anonymous user.""" ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot