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
139
Merge Requests
139
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
6e4819da
Commit
6e4819da
authored
Nov 09, 2016
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: use Person reference and Login reference appropriately.
parent
06647d07
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
32 deletions
+25
-32
product/ERP5/tests/testERP5Base.py
product/ERP5/tests/testERP5Base.py
+1
-1
product/ERP5/tests/testERP5Credential.py
product/ERP5/tests/testERP5Credential.py
+24
-31
No files found.
product/ERP5/tests/testERP5Base.py
View file @
6e4819da
...
@@ -1167,7 +1167,7 @@ class TestERP5Base(ERP5TypeTestCase):
...
@@ -1167,7 +1167,7 @@ class TestERP5Base(ERP5TypeTestCase):
self
.
tic
()
self
.
tic
()
# a user is created
# a user is created
user
=
self
.
portal
.
acl_users
.
getUser
ById
(
'user_login'
)
user
=
self
.
portal
.
acl_users
.
getUser
(
'user_login'
)
self
.
assertNotEquals
(
None
,
user
)
self
.
assertNotEquals
(
None
,
user
)
# and this user has a preference created
# and this user has a preference created
...
...
product/ERP5/tests/testERP5Credential.py
View file @
6e4819da
...
@@ -303,8 +303,7 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -303,8 +303,7 @@ class TestERP5Credential(ERP5TypeTestCase):
self
.
portal
.
ERP5Site_activeLogin
(
mail_message
.
getReference
())
self
.
portal
.
ERP5Site_activeLogin
(
mail_message
.
getReference
())
self
.
login
(
"ERP5TypeTestCase"
)
self
.
login
(
"ERP5TypeTestCase"
)
self
.
tic
()
self
.
tic
()
person
=
portal_catalog
.
getResultValue
(
reference
=
reference
,
person
=
self
.
portal
.
acl_users
.
getUser
(
reference
).
getUserValue
()
portal_type
=
"Person"
)
assignment_list
=
person
.
objectValues
(
portal_type
=
"Assignment"
)
assignment_list
=
person
.
objectValues
(
portal_type
=
"Assignment"
)
self
.
assertEqual
(
len
(
assignment_list
),
1
)
self
.
assertEqual
(
len
(
assignment_list
),
1
)
assignment
=
assignment_list
[
0
]
assignment
=
assignment_list
[
0
]
...
@@ -380,7 +379,7 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -380,7 +379,7 @@ class TestERP5Credential(ERP5TypeTestCase):
last_name
=
'Simpson'
,
reference
=
'homie'
)
last_name
=
'Simpson'
,
reference
=
'homie'
)
self
.
assertEqual
(
len
(
result
),
1
)
self
.
assertEqual
(
len
(
result
),
1
)
sequence
.
edit
(
subscription_request
=
result
[
0
],
sequence
.
edit
(
subscription_request
=
result
[
0
],
perso
n_reference
=
credential_reference
)
logi
n_reference
=
credential_reference
)
def
stepAcceptSubscriptionRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
,
def
stepAcceptSubscriptionRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
**
kw
):
...
@@ -407,9 +406,9 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -407,9 +406,9 @@ class TestERP5Credential(ERP5TypeTestCase):
# check homie can log in the system
# check homie can log in the system
self
.
_assertUserExists
(
'homie'
,
'secret'
)
self
.
_assertUserExists
(
'homie'
,
'secret'
)
self
.
login
(
'homie'
)
self
.
login
ByUserName
(
'homie'
)
from
AccessControl
import
getSecurityManager
from
AccessControl
import
getSecurityManager
self
.
assertEqual
(
getSecurityManager
().
getUser
().
get
IdOr
UserName
(),
'homie'
)
self
.
assertEqual
(
getSecurityManager
().
getUser
().
getUserName
(),
'homie'
)
def
stepCreateCredentialUpdate
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepCreateCredentialUpdate
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
'''
'''
...
@@ -418,10 +417,9 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -418,10 +417,9 @@ class TestERP5Credential(ERP5TypeTestCase):
'''
'''
self
.
login
()
self
.
login
()
# get the 'homie' person object
# get the 'homie' person object
person_module
=
self
.
portal
.
getDefaultModule
(
'Person'
)
result
=
self
.
portal
.
portal_catalog
(
portal_type
=
'ERP5 Login'
,
reference
=
'homie'
)
result
=
person_module
.
searchFolder
(
reference
=
'homie'
)
self
.
assertEqual
(
len
(
result
),
1
)
self
.
assertEqual
(
len
(
result
),
1
)
homie
=
result
[
0
]
homie
=
result
[
0
]
.
getParentValue
()
# create a credential update
# create a credential update
credential_update_module
=
self
.
portal
.
getDefaultModule
(
\
credential_update_module
=
self
.
portal
.
getDefaultModule
(
\
...
@@ -453,9 +451,9 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -453,9 +451,9 @@ class TestERP5Credential(ERP5TypeTestCase):
# check that informations on the person object have been updated
# check that informations on the person object have been updated
person_module
=
self
.
portal
.
getDefaultModule
(
'Person'
)
person_module
=
self
.
portal
.
getDefaultModule
(
'Person'
)
related_
person_result
=
person_module
.
searchFolder
(
reference
=
'homie'
)
related_
login_result
=
self
.
portal
.
portal_catalog
(
portal_type
=
'ERP5 Login'
,
reference
=
'homie'
)
self
.
assertEqual
(
len
(
related_
perso
n_result
),
1
)
self
.
assertEqual
(
len
(
related_
logi
n_result
),
1
)
related_person
=
related_
person_result
[
0
]
related_person
=
related_
login_result
[
0
].
getParentValue
()
self
.
assertEqual
(
related_person
.
getLastName
(),
'Simpsons'
)
self
.
assertEqual
(
related_person
.
getLastName
(),
'Simpsons'
)
self
.
assertEqual
(
related_person
.
getDefaultEmailText
(),
self
.
assertEqual
(
related_person
.
getDefaultEmailText
(),
'homie.simpsons@fox.com'
)
'homie.simpsons@fox.com'
)
...
@@ -609,7 +607,7 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -609,7 +607,7 @@ class TestERP5Credential(ERP5TypeTestCase):
sequence
.
edit
(
barney
=
person
)
sequence
.
edit
(
barney
=
person
)
# check barney can log in the system
# check barney can log in the system
self
.
_assertUserExists
(
'barney-login'
,
'secret'
)
self
.
_assertUserExists
(
'barney-login'
,
'secret'
)
self
.
login
(
'barney
'
)
self
.
login
ByUserName
(
'barney-login
'
)
from
AccessControl
import
getSecurityManager
from
AccessControl
import
getSecurityManager
self
.
assertEqual
(
getSecurityManager
().
getUser
().
getIdOrUserName
(),
'barney'
)
self
.
assertEqual
(
getSecurityManager
().
getUser
().
getIdOrUserName
(),
'barney'
)
...
@@ -658,10 +656,10 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -658,10 +656,10 @@ class TestERP5Credential(ERP5TypeTestCase):
self
.
portal
.
ERP5Site_newCredentialRecovery
(
self
.
portal
.
ERP5Site_newCredentialRecovery
(
default_email_text
=
default_email_text
)
default_email_text
=
default_email_text
)
def
stepLoginAsCurrent
Perso
nReference
(
self
,
sequence
=
None
,
def
stepLoginAsCurrent
Logi
nReference
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
person_reference
=
sequence
[
"perso
n_reference"
]
login_reference
=
sequence
[
"logi
n_reference"
]
self
.
login
(
perso
n_reference
)
self
.
login
ByUserName
(
logi
n_reference
)
def
stepCreateCredentialUpdateWithERP5Site_newCredentialUpdate
(
self
,
def
stepCreateCredentialUpdateWithERP5Site_newCredentialUpdate
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
...
@@ -847,14 +845,14 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -847,14 +845,14 @@ class TestERP5Credential(ERP5TypeTestCase):
def
stepSetAssigneeRoleToCurrentPersonInCredentialUpdateModule
(
self
,
def
stepSetAssigneeRoleToCurrentPersonInCredentialUpdateModule
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
person
_reference
=
sequence
[
"person_reference"
]
person
=
self
.
portal
.
acl_users
.
getUser
(
sequence
[
'login_reference'
]).
getUserValue
()
self
.
portal
.
credential_update_module
.
manage_setLocalRoles
(
person
_reference
,
self
.
portal
.
credential_update_module
.
manage_setLocalRoles
(
person
.
getReference
()
,
[
'Assignor'
,])
[
'Assignor'
,])
def
stepSetAssigneeRoleToCurrentPersonInCredentialRecoveryModule
(
self
,
def
stepSetAssigneeRoleToCurrentPersonInCredentialRecoveryModule
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
person
_reference
=
sequence
[
"person_reference"
]
person
=
self
.
portal
.
acl_users
.
getUser
(
sequence
[
'login_reference'
]).
getUserValue
()
self
.
portal
.
credential_recovery_module
.
manage_setLocalRoles
(
person
_reference
,
self
.
portal
.
credential_recovery_module
.
manage_setLocalRoles
(
person
.
getReference
()
,
[
'Assignor'
,])
[
'Assignor'
,])
def
stepLogin
(
self
,
sequence
):
def
stepLogin
(
self
,
sequence
):
...
@@ -863,8 +861,7 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -863,8 +861,7 @@ class TestERP5Credential(ERP5TypeTestCase):
def
stepCheckPersonAfterSubscriptionRequest
(
self
,
sequence
=
None
,
def
stepCheckPersonAfterSubscriptionRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
self
.
login
()
self
.
login
()
person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
person
=
self
.
portal
.
acl_users
.
getUser
(
sequence
[
'login_reference'
]).
getUserValue
()
reference
=
sequence
[
"person_reference"
],
portal_type
=
"Person"
)
self
.
assertEqual
(
"Homer"
,
person
.
getFirstName
())
self
.
assertEqual
(
"Homer"
,
person
.
getFirstName
())
self
.
assertEqual
(
"Simpson"
,
person
.
getLastName
())
self
.
assertEqual
(
"Simpson"
,
person
.
getLastName
())
self
.
assertEqual
(
"homer.simpson@fox.com"
,
person
.
getDefaultEmailText
())
self
.
assertEqual
(
"homer.simpson@fox.com"
,
person
.
getDefaultEmailText
())
...
@@ -873,17 +870,14 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -873,17 +870,14 @@ class TestERP5Credential(ERP5TypeTestCase):
def
stepSetAuditorRoleToCurrentPerson
(
self
,
sequence
=
None
,
def
stepSetAuditorRoleToCurrentPerson
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
person_reference
=
sequence
[
"person_reference"
]
self
.
login
()
self
.
login
()
person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Person"
,
person
=
self
.
portal
.
acl_users
.
getUser
(
sequence
[
'login_reference'
]).
getUserValue
()
reference
=
person_reference
)
person
.
manage_setLocalRoles
(
person
.
getReference
(),
[
"Auditor"
])
person
.
manage_setLocalRoles
(
person_reference
,
[
"Auditor"
])
self
.
logout
()
self
.
logout
()
def
stepCheckPersonAfterUpdatePerson
(
self
,
sequence
=
None
,
def
stepCheckPersonAfterUpdatePerson
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
person
=
self
.
portal
.
acl_users
.
getUser
(
sequence
[
'login_reference'
]).
getUserValue
()
reference
=
sequence
[
"person_reference"
],
portal_type
=
"Person"
)
self
.
assertEqual
(
"tom"
,
person
.
getFirstName
())
self
.
assertEqual
(
"tom"
,
person
.
getFirstName
())
self
.
assertEqual
(
"Simpson"
,
person
.
getLastName
())
self
.
assertEqual
(
"Simpson"
,
person
.
getLastName
())
self
.
assertEqual
(
"tom@host.com"
,
person
.
getDefaultEmailText
())
self
.
assertEqual
(
"tom@host.com"
,
person
.
getDefaultEmailText
())
...
@@ -1124,8 +1118,7 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -1124,8 +1118,7 @@ class TestERP5Credential(ERP5TypeTestCase):
self.portal.ERP5Site_activeLogin(mail_message.getReference())
self.portal.ERP5Site_activeLogin(mail_message.getReference())
self.login("
ERP5TypeTestCase
")
self.login("
ERP5TypeTestCase
")
self.tic()
self.tic()
person = portal_catalog.getResultValue(reference="
barney
",
person = self.portal.acl_users.getUser('barney').getUserValue()
portal_type="
Person
")
assignment_list = person.objectValues(portal_type="
Assignment
")
assignment_list = person.objectValues(portal_type="
Assignment
")
self.assertNotEquals(assignment_list, [])
self.assertNotEquals(assignment_list, [])
self.assertEqual(len(assignment_list), 1)
self.assertEqual(len(assignment_list), 1)
...
@@ -1234,7 +1227,7 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -1234,7 +1227,7 @@ class TestERP5Credential(ERP5TypeTestCase):
"
stepCheckPersonAfterSubscriptionRequest
"
\
"
stepCheckPersonAfterSubscriptionRequest
"
\
"
SetAuditorRoleToCurrentPerson
"
\
"
SetAuditorRoleToCurrentPerson
"
\
"
SetAssigneeRoleToCurrentPersonInCredentialUpdateModule
Tic
"
\
"
SetAssigneeRoleToCurrentPersonInCredentialUpdateModule
Tic
"
\
"
LoginAsCurrent
Perso
nReference
"
\
"
LoginAsCurrent
Logi
nReference
"
\
"
CreateCredentialUpdateWithERP5Site_newCredentialUpdate
Tic
"
\
"
CreateCredentialUpdateWithERP5Site_newCredentialUpdate
Tic
"
\
"
SelectCredentialUpdate
"
\
"
SelectCredentialUpdate
"
\
"
AcceptCredentialUpdate
Tic
"
\
"
AcceptCredentialUpdate
Tic
"
\
...
@@ -1297,7 +1290,7 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -1297,7 +1290,7 @@ class TestERP5Credential(ERP5TypeTestCase):
'''
'''
sequence_list = SequenceList()
sequence_list = SequenceList()
sequence_string = "
CreatePersonWithQuestionUsingCamelCase
Tic
"
\
sequence_string = "
CreatePersonWithQuestionUsingCamelCase
Tic
"
\
"
LoginAsCurrent
Perso
nReference
"
\
"
LoginAsCurrent
Logi
nReference
"
\
"
CreateCredentialRecoveryWithSensitiveAnswer
Tic
"
\
"
CreateCredentialRecoveryWithSensitiveAnswer
Tic
"
\
"
AcceptCredentialRecovery
Tic
"
\
"
AcceptCredentialRecovery
Tic
"
\
"
CheckEmailIsSent
Tic
"
\
"
CheckEmailIsSent
Tic
"
\
...
...
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