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
francois
erp5
Commits
d80c0cc4
Commit
d80c0cc4
authored
Oct 20, 2016
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: use different reference between Person and ERP5 Login in testERP5Credential.
parent
560ccc5d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
19 deletions
+33
-19
product/ERP5/tests/testERP5Credential.py
product/ERP5/tests/testERP5Credential.py
+33
-19
No files found.
product/ERP5/tests/testERP5Credential.py
View file @
d80c0cc4
...
...
@@ -322,7 +322,6 @@ class TestERP5Credential(ERP5TypeTestCase):
from
Products.PluggableAuthService.interfaces.plugins
import
\
IAuthenticationPlugin
uf
=
self
.
getUserFolder
()
self
.
assertNotEquals
(
uf
.
getUserById
(
login
,
None
),
None
)
for
plugin_name
,
plugin
in
uf
.
_getOb
(
'plugins'
).
listPlugins
(
IAuthenticationPlugin
):
if
plugin
.
authenticateCredentials
(
...
...
@@ -558,11 +557,12 @@ class TestERP5Credential(ERP5TypeTestCase):
# create a login
login
=
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
person
.
getReference
(),
reference
=
person
.
getReference
()
+
'-login'
,
password
=
'secret'
,
)
login
.
validate
()
sequence
.
edit
(
person_reference
=
person
.
getReference
(),
login_reference
=
login
.
getReference
(),
default_email_text
=
person
.
getDefaultEmailText
())
def
stepCreateSameEmailPersonList
(
self
,
sequence
=
None
,
sequence_list
=
None
,
...
...
@@ -587,7 +587,7 @@ class TestERP5Credential(ERP5TypeTestCase):
# create a login
login
=
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
person
.
getReference
(),
reference
=
person
.
getReference
()
+
'-login'
,
password
=
'secret'
,
)
login
.
validate
()
...
...
@@ -603,11 +603,12 @@ class TestERP5Credential(ERP5TypeTestCase):
'''
portal
=
self
.
getPortalObject
()
person_reference
=
sequence
[
"person_reference"
]
login_reference
=
sequence
[
"login_reference"
]
person
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Person"
,
reference
=
person_reference
)
sequence
.
edit
(
barney
=
person
)
# check barney can log in the system
self
.
_assertUserExists
(
'barney'
,
'secret'
)
self
.
_assertUserExists
(
'barney
-login
'
,
'secret'
)
self
.
login
(
'barney'
)
from
AccessControl
import
getSecurityManager
self
.
assertEqual
(
str
(
getSecurityManager
().
getUser
()),
'barney'
)
...
...
@@ -620,7 +621,7 @@ class TestERP5Credential(ERP5TypeTestCase):
# associate it with barney
credential_recovery
.
setDestinationDecisionValue
(
person
)
credential_recovery
.
setReference
(
person
.
getReference
()
)
credential_recovery
.
setReference
(
login_reference
)
sequence
.
edit
(
credential_recovery
=
credential_recovery
)
def
stepCreateCredentialRecoveryForUsername
(
self
,
sequence
=
None
,
sequence_list
=
None
,
...
...
@@ -648,8 +649,8 @@ class TestERP5Credential(ERP5TypeTestCase):
def
stepRequestCredentialRecoveryWithERP5Site_newCredentialRecovery
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
person_reference
=
sequence
[
"perso
n_reference"
]
self
.
portal
.
ERP5Site_newCredentialRecovery
(
reference
=
perso
n_reference
)
login_reference
=
sequence
[
"logi
n_reference"
]
self
.
portal
.
ERP5Site_newCredentialRecovery
(
reference
=
logi
n_reference
)
def
stepRequestCredentialRecoveryWithERP5Site_newCredentialRecoveryByEmail
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
...
...
@@ -669,9 +670,9 @@ class TestERP5Credential(ERP5TypeTestCase):
def
stepCreateCredentialRecoveryWithSensitiveAnswer
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
person_reference
=
sequence
[
"perso
n_reference"
]
login_reference
=
sequence
[
"logi
n_reference"
]
result
=
self
.
portal
.
ERP5Site_newCredentialRecovery
(
reference
=
perso
n_reference
,
reference
=
logi
n_reference
,
default_credential_question_question
=
'credential/library_card_number'
,
default_credential_question_answer
=
'ABCDeF'
,
)
...
...
@@ -680,7 +681,7 @@ class TestERP5Credential(ERP5TypeTestCase):
self
.
tic
()
self
.
login
()
result_list
=
self
.
portal
.
portal_catalog
(
portal_type
=
'Credential Recovery'
,
reference
=
perso
n_reference
)
portal_type
=
'Credential Recovery'
,
reference
=
logi
n_reference
)
self
.
assertEqual
(
1
,
len
(
result_list
))
credential_recovery
=
result_list
[
0
]
sequence
.
edit
(
credential_recovery
=
credential_recovery
)
...
...
@@ -694,9 +695,9 @@ class TestERP5Credential(ERP5TypeTestCase):
def
stepCheckCredentialRecoveryCreation
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
person_reference
=
sequence
[
"perso
n_reference"
]
login_reference
=
sequence
[
"logi
n_reference"
]
result_list
=
self
.
portal
.
portal_catalog
(
portal_type
=
'Credential Recovery'
,
reference
=
perso
n_reference
)
portal_type
=
'Credential Recovery'
,
reference
=
logi
n_reference
)
self
.
assertEqual
(
1
,
len
(
result_list
))
credential_recovery
=
result_list
[
0
]
person
=
credential_recovery
.
getDestinationDecisionValue
()
...
...
@@ -788,8 +789,8 @@ class TestERP5Credential(ERP5TypeTestCase):
self
.
assertTrue
(
'reset_key'
in
parameters
)
key
=
parameters
[
'reset_key'
][
0
]
# before changing, check that the user exists with 'secret' password
self
.
_assertUserExists
(
'barney'
,
'secret'
)
self
.
portal
.
portal_password
.
changeUserPassword
(
user_login
=
"barney"
,
self
.
_assertUserExists
(
'barney
-login
'
,
'secret'
)
self
.
portal
.
portal_password
.
changeUserPassword
(
user_login
=
"barney
-login
"
,
password
=
"new_password"
,
password_confirm
=
"new_password"
,
password_key
=
key
)
...
...
@@ -797,10 +798,10 @@ class TestERP5Credential(ERP5TypeTestCase):
# reset the cache
self
.
portal
.
portal_caches
.
clearAllCache
()
# check we cannot login anymore with the previous password 'secret'
self
.
_assertUserDoesNotExists
(
'barney'
,
'secret'
)
self
.
_assertUserDoesNotExists
(
'barney
-login
'
,
'secret'
)
# check we can now login with the new password 'new_password'
self
.
_assertUserExists
(
'barney'
,
'new_password'
)
self
.
_assertUserExists
(
'barney
-login
'
,
'new_password'
)
def
_createCredentialRequest
(
self
,
first_name
=
"Barney"
,
last_name
=
"Simpson"
,
...
...
@@ -1247,10 +1248,16 @@ class TestERP5Credential(ERP5TypeTestCase):
reference = self.id()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference,
password='secret',
role='internal')
assignment = person.newContent(portal_type='Assignment', function='manager')
assignment.open()
# create a login
login = person.newContent(
portal_type='ERP5 Login',
reference=person.getReference() + '-login',
password='secret',
)
login.validate()
self.commit()
credential_update = self.portal.credential_update_module.newContent(
portal_type='Credential Update',
...
...
@@ -1268,13 +1275,20 @@ class TestERP5Credential(ERP5TypeTestCase):
person_module = self.portal.getDefaultModule('Person')
person = person_module.newContent(title='Barney',
reference='barney',
password='secret',
default_email_text='barney@duff.com')
# create an assignment
assignment = person.newContent(portal_type='Assignment',
function='member')
assignment.open()
sequence.edit(person_reference=person.getReference())
# create a login
login = person.newContent(
portal_type='ERP5 Login',
reference=person.getReference() + '-login',
password='secret',
)
login.validate()
sequence.edit(person_reference=person.getReference(),
login_reference=login.getReference())
def test_checkCredentialQuestionIsNotCaseSensitive(self):
'''
...
...
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