Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
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
Romain Courteaud
erp5_rtl_support
Commits
d36dcfb4
Commit
d36dcfb4
authored
Aug 29, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move test to proper class.
parent
7a41c1c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
44 deletions
+43
-44
product/ERP5Security/tests/testERP5Security.py
product/ERP5Security/tests/testERP5Security.py
+43
-44
No files found.
product/ERP5Security/tests/testERP5Security.py
View file @
d36dcfb4
...
...
@@ -445,6 +445,49 @@ class TestUserManagement(ERP5TypeTestCase):
self
.
assertEqual
(
response
.
getStatus
(),
200
)
self
.
assertTrue
(
reference
in
response
.
getBody
())
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'
,
reference
=
reference
,
password
=
'guest'
)
assignment
=
loginable_person
.
newContent
(
portal_type
=
'Assignment'
,
function
=
'another_subcat'
)
assignment
.
open
()
self
.
stepTic
()
base_url
=
portal
.
absolute_url
(
relative
=
1
)
# without key we are Anonymous User so we should be redirected with proper HTML
# status code to login_form
response
=
self
.
publish
(
base_url
)
self
.
assertEqual
(
response
.
getStatus
(),
302
)
# TODO we should not have redirect but output 403 or 404, because
# login process should be provided by an external application.
# self.assertTrue('location' in response.headers.keys())
# 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
})
self
.
assertEqual
(
response
.
getStatus
(),
200
)
self
.
assertTrue
(
reference
in
response
.
getBody
())
class
TestLocalRoleManagement
(
ERP5TypeTestCase
):
...
...
@@ -818,50 +861,6 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
base_url
,
web_page
.
getReference
(),
'ERP5TypeTestCase'
,
''
))
self
.
assertEqual
(
response
.
getStatus
(),
200
)
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'
,
reference
=
reference
,
password
=
'guest'
)
assignment
=
loginable_person
.
newContent
(
portal_type
=
'Assignment'
,
function
=
'another_subcat'
)
assignment
.
open
()
self
.
stepTic
()
base_url
=
portal
.
absolute_url
(
relative
=
1
)
# without key we are Anonymous User so we should be redirected with proper HTML
# status code to login_form
response
=
self
.
publish
(
base_url
)
self
.
assertEqual
(
response
.
getStatus
(),
302
)
# TODO we should not have redirect but output 403 or 404, because
# login process should be provided by an external application.
# self.assertTrue('location' in response.headers.keys())
# 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
})
self
.
assertEqual
(
response
.
getStatus
(),
200
)
self
.
assertTrue
(
reference
in
response
.
getBody
())
def
_createZodbUser
(
self
,
login
,
role_list
=
None
):
if
role_list
is
None
:
role_list
=
[
'Member'
,
'Assignee'
,
'Assignor'
,
'Author'
,
'Auditor'
,
...
...
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