plone.restapi/plone-only-login: Add test using a zope user
Victor Fernandez de Alba <jenkins-z4DKO/[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.cvs |
|---|---|
| Message-ID | <[email protected]> |
Repository: plone.restapi Branch: refs/heads/plone-only-login Date: 2017-07-18T17:51:30+02:00 Author: Victor Fernandez de Alba (sneridagh) <[email protected]> Commit: https://github.com/plone/plone.restapi/commit/6f6b48b36ff65b6bf87df5a6a939c3f0db0bf0b2 Add test using a zope user Files changed: M src/plone/restapi/tests/test_auth.py diff --git a/src/plone/restapi/tests/test_auth.py b/src/plone/restapi/tests/test_auth.py index e413bae8..46433af3 100644 --- a/src/plone/restapi/tests/test_auth.py +++ b/src/plone/restapi/tests/test_auth.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from Acquisition import aq_parent from ZPublisher.pubevents import PubStart from plone.app.testing import SITE_OWNER_NAME from plone.app.testing import SITE_OWNER_PASSWORD @@ -79,6 +80,17 @@ def test_login_without_api_permission(self): res = service.render() self.assertIn('token', res) + def test_unsuccessful_login_using_zope_user(self): + zacl_users = aq_parent(self.portal).acl_users + zacl_users.userFolderAddUser('zope_user', 'secret', [''], []) + self.request['BODY'] = '{"login": "%s", "password": "%s"}' % ( + 'zope_user', + 'secret' + ) + service = self.traverse() + service.reply() + self.assertEqual(401, self.request.response.getStatus()) + class TestLogout(TestCase): ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot