Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xueyun Qian
erp5
Commits
f51bd472
Commit
f51bd472
authored
Aug 29, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run the whole test suite with plugin activated.
Activation of additional plugin shall not impact another tests.
parent
dcded9db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
16 deletions
+20
-16
product/ERP5Security/tests/testERP5Security.py
product/ERP5Security/tests/testERP5Security.py
+20
-16
No files found.
product/ERP5Security/tests/testERP5Security.py
View file @
f51bd472
...
...
@@ -445,24 +445,27 @@ class TestUserManagement(ERP5TypeTestCase):
self
.
assertEqual
(
response
.
getStatus
(),
200
)
self
.
assertTrue
(
reference
in
response
.
getBody
())
class
TestUserManagementExternalAuthentication
(
TestUserManagement
):
def
afterSetUp
(
self
):
self
.
user_id_key
=
'openAMid'
# add key authentication PAS plugin
uf
=
self
.
portal
.
acl_users
plugin_id
=
'erp5_external_authentication_plugin'
if
plugin_id
not
in
uf
.
objectIds
():
uf
.
manage_addProduct
[
'ERP5Security'
].
addERP5ExternalAuthenticationPlugin
(
id
=
plugin_id
,
\
title
=
'ERP5 External Authentication Plugin'
,
\
user_id_key
=
self
.
user_id_key
,)
getattr
(
uf
,
plugin_id
).
manage_activateInterfaces
(
interfaces
=
[
'IExtractionPlugin'
,
'IAuthenticationPlugin'
])
self
.
stepTic
()
def
testERP5ExternalAuthenticationPlugin
(
self
):
"""
Make sure that we can grant security using a ERP5 External Authentication Plugin.
"""
user_id_key
=
'openAMid'
# add key authentication PAS plugin
portal
=
self
.
portal
uf
=
portal
.
acl_users
uf
.
manage_addProduct
[
'ERP5Security'
].
addERP5ExternalAuthenticationPlugin
(
id
=
'erp5_external_authentication_plugin'
,
\
title
=
'ERP5 External Authentication Plugin'
,
\
user_id_key
=
user_id_key
,)
erp5_external_authentication_plugin
=
getattr
(
uf
,
'erp5_external_authentication_plugin'
)
erp5_external_authentication_plugin
.
manage_activateInterfaces
(
interfaces
=
[
'IExtractionPlugin'
,
'IAuthenticationPlugin'
])
self
.
stepTic
()
reference
=
'external_auth_person'
loginable_person
=
self
.
getPersonModule
().
newContent
(
portal_type
=
'Person'
,
...
...
@@ -472,7 +475,7 @@ class TestUserManagement(ERP5TypeTestCase):
assignment
.
open
()
self
.
stepTic
()
base_url
=
portal
.
absolute_url
(
relative
=
1
)
base_url
=
self
.
portal
.
absolute_url
(
relative
=
1
)
# without key we are Anonymous User so we should be redirected with proper HTML
# status code to login_form
...
...
@@ -484,7 +487,7 @@ class TestUserManagement(ERP5TypeTestCase):
# self.assertTrue(response.headers['location'].endswith('login_form'))
# view front page we should be logged in if we use authentication key
response
=
self
.
publish
(
base_url
,
env
=
{
user_id_key
.
replace
(
'-'
,
'_'
).
upper
():
reference
})
response
=
self
.
publish
(
base_url
,
env
=
{
self
.
user_id_key
.
replace
(
'-'
,
'_'
).
upper
():
reference
})
self
.
assertEqual
(
response
.
getStatus
(),
200
)
self
.
assertTrue
(
reference
in
response
.
getBody
())
...
...
@@ -946,5 +949,6 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestUserManagement
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestUserManagementExternalAuthentication
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestLocalRoleManagement
))
return
suite
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment