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
Labels
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
2c557347
Commit
2c557347
authored
Jul 18, 2011
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test calculation of early password expiration warning.
parent
495bf49e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
product/ERP5/tests/testAuthenticationPolicy.py
product/ERP5/tests/testAuthenticationPolicy.py
+23
-2
No files found.
product/ERP5/tests/testAuthenticationPolicy.py
View file @
2c557347
...
@@ -376,6 +376,8 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
...
@@ -376,6 +376,8 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
Test password expire.
Test password expire.
"""
"""
portal
=
self
.
getPortal
()
portal
=
self
.
getPortal
()
request
=
self
.
app
.
REQUEST
self
.
assertTrue
(
portal
.
ERP5Site_isAuthenticationPolicyEnabled
())
self
.
assertTrue
(
portal
.
ERP5Site_isAuthenticationPolicyEnabled
())
person
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Person'
,
person
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Person'
,
...
@@ -387,6 +389,7 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
...
@@ -387,6 +389,7 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
self
.
stepTic
()
self
.
stepTic
()
self
.
_clearCache
()
self
.
_clearCache
()
self
.
assertFalse
(
person
.
isPasswordExpired
())
self
.
assertFalse
(
person
.
isPasswordExpired
())
self
.
assertFalse
(
request
[
'is_user_account_password_expired'
])
# set older last password modification date just for test
# set older last password modification date just for test
now
=
DateTime
()
now
=
DateTime
()
...
@@ -394,12 +397,30 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
...
@@ -394,12 +397,30 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
self
.
stepTic
()
self
.
stepTic
()
self
.
_clearCache
()
self
.
_clearCache
()
self
.
assertTrue
(
person
.
isPasswordExpired
())
self
.
assertTrue
(
person
.
isPasswordExpired
())
self
.
assertTrue
(
request
[
'is_user_account_password_expired'
])
# set longer password validity interval
# set longer password validity interval
preference
.
setPreferredMaxPasswordLifetimeDuration
(
4
*
24
)
person
.
setLastPasswordModificationDate
(
now
)
preference
.
setPreferredMaxPasswordLifetimeDuration
(
4
*
24
)
# password expire in 4 days
self
.
stepTic
()
self
.
_clearCache
()
self
.
assertFalse
(
person
.
isPasswordExpired
())
self
.
assertFalse
(
request
[
'is_user_account_password_expired'
])
# test early warning password expire notification is detected
preference
.
setPreferredPasswordLifetimeExpireWarningDuration
(
4
*
24
)
# password expire notification appear immediately
self
.
stepTic
()
self
.
stepTic
()
self
.
_clearCache
()
self
.
_clearCache
()
self
.
assertFalse
(
person
.
isPasswordExpired
())
self
.
assertFalse
(
person
.
isPasswordExpired
())
self
.
assertTrue
(
request
[
'is_user_account_password_expired_warning_on'
])
# test early warning password expire notification is detected
preference
.
setPreferredPasswordLifetimeExpireWarningDuration
(
4
*
24
-
24
)
# password expire notification appear 3 days befor time
self
.
stepTic
()
self
.
_clearCache
()
self
.
assertFalse
(
person
.
isPasswordExpired
())
#import pdb; pdb.set_trace()
self
.
assertFalse
(
request
[
'is_user_account_password_expired_warning_on'
])
def
test_suite
():
def
test_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