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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Laurent S
erp5
Commits
4e961a54
Commit
4e961a54
authored
Jan 05, 2017
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testAuthenticationPolicy: add missing test for automatic password recovery
parent
0868b311
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
product/ERP5/tests/testAuthenticationPolicy.py
product/ERP5/tests/testAuthenticationPolicy.py
+42
-0
No files found.
product/ERP5/tests/testAuthenticationPolicy.py
View file @
4e961a54
...
...
@@ -554,6 +554,48 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
self
.
assertFalse
(
login
.
isPasswordExpired
())
self
.
assertFalse
(
request
[
'is_user_account_password_expired_expire_date'
])
def
test_SystemRecoverExpiredPassword
(
self
):
"""
Test automatic system recover password
"""
portal
=
self
.
portal
request
=
self
.
app
.
REQUEST
self
.
assertTrue
(
portal
.
portal_preferences
.
isAuthenticationPolicyEnabled
())
preference
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'System Preference'
,
title
=
'Authentication'
,)
preference
.
setPreferredMaxPasswordLifetimeDuration
(
0
)
# password expire immediatly
preference
.
setPreferredSystemRecoverExpiredPassword
(
True
)
self
.
_clearCache
()
self
.
tic
()
person
=
self
.
createUser
(
self
.
id
(),
password
=
'password'
)
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
.
open
()
login
=
person
.
objectValues
(
portal_type
=
'ERP5 Login'
)[
0
]
self
.
tic
()
self
.
_clearCache
()
time
.
sleep
(
1
)
self
.
assertTrue
(
login
.
isPasswordExpired
())
# User cannot login
path
=
portal
.
absolute_url_path
()
+
'/view?__ac_name=%s&__ac_password=%s'
%
(
self
.
id
(),
'password'
)
response
=
self
.
publish
(
path
)
self
.
assertTrue
(
response
.
getHeader
(
"Location"
).
endswith
(
"login_form"
))
self
.
tic
()
# and a credential recovery is created automatically
credential_recovery
,
=
login
.
getDestinationDecisionRelatedValueList
(
portal_type
=
'Credential Recovery'
)
# trying to login again does not create a new credential recovery
response
=
self
.
publish
(
path
)
self
.
tic
()
credential_recovery
,
=
login
.
getDestinationDecisionRelatedValueList
(
portal_type
=
'Credential Recovery'
)
def
test_HttpRequest
(
self
):
"""
Check HTTP responses
...
...
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