Commit 99d048f7 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

configure appropriate roles for testKeyAuthentication and extend it for...

configure appropriate roles for testKeyAuthentication and extend it for reference-based web access, that is the only failure case for now.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43789 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 43fcc134
...@@ -51,7 +51,7 @@ class TestUserManagement(ERP5TypeTestCase): ...@@ -51,7 +51,7 @@ class TestUserManagement(ERP5TypeTestCase):
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
"""List of BT to install. """ """List of BT to install. """
return ('erp5_base', 'erp5_web',) return ('erp5_base', 'erp5_web', 'erp5_ingestion', 'erp5_dms',)
def beforeTearDown(self): def beforeTearDown(self):
"""Clears person module and invalidate caches when tests are finished.""" """Clears person module and invalidate caches when tests are finished."""
...@@ -701,6 +701,15 @@ class TestLocalRoleManagement(ERP5TypeTestCase): ...@@ -701,6 +701,15 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
assignment = loginable_person.newContent(portal_type='Assignment', assignment = loginable_person.newContent(portal_type='Assignment',
function='another_subcat') function='another_subcat')
assignment.open() assignment.open()
portal_types = portal.portal_types
for portal_type in ('Person Module', 'Person', 'Web Site Module', 'Web Site',
'Web Page'):
type_information = portal_types[portal_type]
type_information.newContent(
portal_type='Role Information',
role_name=('Auditor', 'Assignee'),
role_category='function/another_subcat')
type_information.updateRoleMapping()
self.stepTic() self.stepTic()
# encrypt & decrypt works # encrypt & decrypt works
...@@ -734,14 +743,25 @@ class TestLocalRoleManagement(ERP5TypeTestCase): ...@@ -734,14 +743,25 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
# check if key authentication works with web_mode too # check if key authentication works with web_mode too
web_site = portal.web_site_module.newContent(portal_type='Web Site') web_site = portal.web_site_module.newContent(portal_type='Web Site')
web_page = portal.web_page_module.newContent(portal_type='Web Page', reference='ref')
web_page.release()
self.stepTic()
base_url = web_site.absolute_url(relative=1) base_url = web_site.absolute_url(relative=1)
response = self.publish(base_url) response = self.publish(base_url)
self.assertEqual(response.getStatus(), 302) self.assertEqual(response.getStatus(), 302)
self.assertTrue('location' in response.headers.keys()) self.assertTrue('location' in response.headers.keys())
self.assertTrue('%s/login_form?came_from=' % portal.getId(), response.headers['location']) self.assertTrue('%s/login_form?came_from=' % portal.getId(), response.headers['location'])
# web site access
response = self.publish('%s?__ac_key=%s' %(base_url, key)) response = self.publish('%s?__ac_key=%s' %(base_url, key))
self.assertEqual(response.getStatus(), 200) self.assertEqual(response.getStatus(), 200)
self.assertTrue(reference in response.getBody()) # web page access by path
response = self.publish('%s/%s?__ac_key=%s' %(base_url, web_page.getRelativeUrl(),
key))
self.assertEqual(response.getStatus(), 200)
# web page access by reference
response = self.publish('%s/%s?__ac_key=%s' %(base_url, web_page.getReference(),
key))
self.assertEqual(response.getStatus(), 200)
def testERP5ExternalAuthenticationPlugin(self): def testERP5ExternalAuthenticationPlugin(self):
""" """
......
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