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
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
6a44a135
Commit
6a44a135
authored
Jul 15, 2020
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testAuthenticationPolicy: test no password event behavior
parent
a31eab5f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletion
+20
-1
product/ERP5/tests/testAuthenticationPolicy.py
product/ERP5/tests/testAuthenticationPolicy.py
+20
-1
No files found.
product/ERP5/tests/testAuthenticationPolicy.py
View file @
6a44a135
...
@@ -132,6 +132,7 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
...
@@ -132,6 +132,7 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
reference
=
username
,
reference
=
username
,
password
=
password
)
password
=
password
)
login
.
validate
()
login
.
validate
()
self
.
tic
()
return
person
return
person
def
test_BlockLogin
(
self
):
def
test_BlockLogin
(
self
):
...
@@ -545,14 +546,32 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
...
@@ -545,14 +546,32 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
self
.
assertTrue
(
portal
.
portal_preferences
.
isAuthenticationPolicyEnabled
())
self
.
assertTrue
(
portal
.
portal_preferences
.
isAuthenticationPolicyEnabled
())
preference
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'System Preference'
,
preference
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'System Preference'
,
title
=
'Authentication'
,)
title
=
'Authentication'
,)
preference
.
setPreferredMaxPasswordLifetimeDuration
(
24
)
# No password event will be created for such configuration
preference
.
setPreferredNumberOfLastPasswordToCheck
(
0
)
preference
.
setPreferredMaxPasswordLifetimeDuration
(
None
)
self
.
tic
()
self
.
tic
()
self
.
_clearCache
()
self
.
_clearCache
()
person
=
self
.
createUser
(
'test-04'
,
person
=
self
.
createUser
(
'test-04'
,
password
=
'used_ALREADY_1234'
)
password
=
'used_ALREADY_1234'
)
login
=
person
.
objectValues
(
portal_type
=
'ERP5 Login'
)[
0
]
login
=
person
.
objectValues
(
portal_type
=
'ERP5 Login'
)[
0
]
self
.
assertEqual
(
login
.
getDestinationRelatedValue
(
portal_type
=
'Password Event'
),
None
)
self
.
assertFalse
(
login
.
isPasswordExpired
())
self
.
assertFalse
(
request
[
'is_user_account_password_expired'
])
# password is expired if no passwor event
preference
.
setPreferredMaxPasswordLifetimeDuration
(
24
)
self
.
tic
()
self
.
_clearCache
()
self
.
assertEqual
(
login
.
getDestinationRelatedValue
(
portal_type
=
'Password Event'
),
None
)
self
.
assertTrue
(
login
.
isPasswordExpired
())
self
.
assertTrue
(
request
[
'is_user_account_password_expired'
])
# now set password to trigger password event creation
login
.
setPassword
(
'used_ALREADY_1234'
)
self
.
tic
()
self
.
_clearCache
()
self
.
assertTrue
(
login
.
getDestinationRelatedValue
(
portal_type
=
'Password Event'
)
is
not
None
)
self
.
assertFalse
(
login
.
isPasswordExpired
())
self
.
assertFalse
(
login
.
isPasswordExpired
())
self
.
assertFalse
(
request
[
'is_user_account_password_expired'
])
self
.
assertFalse
(
request
[
'is_user_account_password_expired'
])
...
...
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