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
Mikolaï Krol
erp5
Commits
d1627ffc
Commit
d1627ffc
authored
Jun 28, 2011
by
Gabriel Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test to ERP5Site_newPersonCredentialUpdate and reorganize steps
parent
563b7e99
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
146 additions
and
65 deletions
+146
-65
product/ERP5/tests/testERP5Credential.py
product/ERP5/tests/testERP5Credential.py
+146
-65
No files found.
product/ERP5/tests/testERP5Credential.py
View file @
d1627ffc
...
@@ -230,7 +230,6 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -230,7 +230,6 @@ class TestERP5Credential(ERP5TypeTestCase):
preferred_organisation_credential_update_automatic_approval
=
False
,
preferred_organisation_credential_update_automatic_approval
=
False
,
preferred_person_credential_update_automatic_approval
=
False
,
preferred_person_credential_update_automatic_approval
=
False
,
preferred_credential_alarm_automatic_call
=
True
)
preferred_credential_alarm_automatic_call
=
True
)
self
.
_enablePreference
()
self
.
_enablePreference
()
transaction
.
commit
()
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
...
@@ -358,24 +357,28 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -358,24 +357,28 @@ class TestERP5Credential(ERP5TypeTestCase):
# check annonymous can access subscription form
# check annonymous can access subscription form
self
.
assertTrue
(
"Desired Login Name"
in
request
.
traverse
(
form_url
)())
self
.
assertTrue
(
"Desired Login Name"
in
request
.
traverse
(
form_url
)())
# fill in and submit the subscription form
# fill in and submit the subscription form
credential_reference
=
'homie'
result
=
self
.
portal
.
ERP5Site_newCredentialRequest
(
\
result
=
self
.
portal
.
ERP5Site_newCredentialRequest
(
\
first_name
=
'Homer'
,
first_name
=
'Homer'
,
last_name
=
'Simpson'
,
last_name
=
'Simpson'
,
reference
=
'homie'
,
reference
=
credential_reference
,
password
=
'secret'
,
password
=
'secret'
,
default_email_text
=
'homer.simpson@fox.com'
,
default_email_text
=
'homer.simpson@fox.com'
,
role_list
=
[
'internal'
],
role_list
=
[
'internal'
],
)
)
self
.
assertTrue
(
'portal_status_message=Credential%20Request%20Created.'
\
portal_status_message
=
sequence
.
get
(
"portal_status_message"
,
in
result
)
"Credential%20Request%20Created."
)
# if 'portal_status_message=%s' % portal_status_message not in result:
# import ipdb;ipdb.set_trace()
self
.
assertTrue
(
'portal_status_message=%s'
%
portal_status_message
in
result
,
result
)
credential_request_module
=
self
.
portal
.
getDefaultModule
(
'Credential Request'
)
credential_request_module
=
self
.
portal
.
getDefaultModule
(
'Credential Request'
)
result
=
credential_request_module
.
contentValues
(
\
result
=
credential_request_module
.
contentValues
(
\
portal_type
=
'Credential Request'
,
first_name
=
'Homer'
,
portal_type
=
'Credential Request'
,
first_name
=
'Homer'
,
last_name
=
'Simpson'
,
reference
=
'homie'
)
last_name
=
'Simpson'
,
reference
=
'homie'
)
self
.
assertEquals
(
len
(
result
),
1
)
self
.
assertEquals
(
len
(
result
),
1
)
sequence
.
edit
(
subscription_request
=
result
[
0
])
sequence
.
edit
(
subscription_request
=
result
[
0
],
person_reference
=
credential_reference
)
def
stepAcceptSubscriptionRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
,
def
stepAcceptSubscriptionRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
**
kw
):
...
@@ -384,6 +387,13 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -384,6 +387,13 @@ class TestERP5Credential(ERP5TypeTestCase):
subscription_request
.
accept
()
subscription_request
.
accept
()
self
.
logout
()
self
.
logout
()
def
stepSubmitSubscriptionRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
self
.
login
()
subscription_request
=
sequence
.
get
(
'subscription_request'
)
subscription_request
.
submit
()
self
.
logout
()
def
stepCheckAccountIsCreated
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepCheckAccountIsCreated
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
# check a person have been created
# check a person have been created
person_module
=
self
.
portal
.
getDefaultModule
(
'Person'
)
person_module
=
self
.
portal
.
getDefaultModule
(
'Person'
)
...
@@ -578,6 +588,23 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -578,6 +588,23 @@ class TestERP5Credential(ERP5TypeTestCase):
person_reference
=
sequence
[
"person_reference"
]
person_reference
=
sequence
[
"person_reference"
]
self
.
portal
.
ERP5Site_newCredentialRecovery
(
reference
=
person_reference
)
self
.
portal
.
ERP5Site_newCredentialRecovery
(
reference
=
person_reference
)
def
stepLoginAsCurrentPersonReference
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
person_reference
=
sequence
[
"person_reference"
]
self
.
login
(
person_reference
)
def
stepCreateCredentialUpdateWithERP5Site_newCredentialUpdate
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
self
.
portal
.
ERP5Site_newPersonCredentialUpdate
(
first_name
=
"tom"
,
default_email_text
=
"tom@host.com"
)
def
stepSelectCredentialUpdate
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
self
.
login
()
credential_update
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Credential Update"
)
sequence
[
"credential_update"
]
=
credential_update
def
stepCheckCredentialRecoveryCreation
(
self
,
sequence
=
None
,
def
stepCheckCredentialRecoveryCreation
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
person_reference
=
sequence
[
"person_reference"
]
person_reference
=
sequence
[
"person_reference"
]
...
@@ -588,6 +615,7 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -588,6 +615,7 @@ class TestERP5Credential(ERP5TypeTestCase):
person
=
credential_recovery
.
getDestinationDecisionValue
()
person
=
credential_recovery
.
getDestinationDecisionValue
()
self
.
assertEquals
(
"Barney"
,
person
.
getTitle
())
self
.
assertEquals
(
"Barney"
,
person
.
getTitle
())
self
.
assertEquals
(
"barney@duff.com"
,
person
.
getEmailText
())
self
.
assertEquals
(
"barney@duff.com"
,
person
.
getEmailText
())
sequence
[
"credential_recovery"
]
=
credential_recovery
def
stepSubmitCredentialRecovery
(
self
,
sequence
=
None
,
sequence_list
=
None
,
def
stepSubmitCredentialRecovery
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
**
kw
):
...
@@ -604,6 +632,10 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -604,6 +632,10 @@ class TestERP5Credential(ERP5TypeTestCase):
Check an email containing the password reset link as been sent
Check an email containing the password reset link as been sent
'''
'''
barney
=
sequence
.
get
(
'barney'
)
barney
=
sequence
.
get
(
'barney'
)
if
not
barney
:
reference
=
sequence
.
get
(
'person_reference'
)
barney
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Person"
,
reference
=
reference
)
# after accept, an email is send containing the reset link
# after accept, an email is send containing the reset link
last_message
=
self
.
portal
.
MailHost
.
_last_message
last_message
=
self
.
portal
.
MailHost
.
_last_message
...
@@ -660,7 +692,69 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -660,7 +692,69 @@ class TestERP5Credential(ERP5TypeTestCase):
# check we can now login with the new password 'new_password'
# check we can now login with the new password 'new_password'
self
.
_assertUserExists
(
'barney'
,
'new_password'
)
self
.
_assertUserExists
(
'barney'
,
'new_password'
)
def
test_01_simpleSubsciptionRequest
(
self
):
def
_createCredentialRequest
(
self
,
first_name
=
"Gabriel"
,
last_name
=
"Monnerat"
,
reference
=
"gabriel"
,
password
=
"123"
,
default_email_text
=
"gabriel@test.com"
):
self
.
logout
()
self
.
portal
.
ERP5Site_newCredentialRequest
(
first_name
=
first_name
,
last_name
=
last_name
,
reference
=
reference
,
password
=
password
,
career_subordination_title
=
""
,
default_email_text
=
default_email_text
,
default_telephone_text
=
"223344"
,
default_address_street_address
=
"Test Street"
,
default_address_city
=
"Campos"
,
default_address_zip_code
=
"28024030"
)
self
.
login
(
"ERP5TypeTestCase"
)
self
.
stepTic
()
def
stepCreateCredentialRequestSample
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
credential_reference
=
"credential_reference"
self
.
_createCredentialRequest
(
reference
=
credential_reference
)
sequence
.
edit
(
credential_reference
=
credential_reference
)
def
stepCheckIfMailMessageWasPosted
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
credential_reference_str
=
sequence
[
"credential_reference"
]
portal_catalog
=
self
.
portal
.
portal_catalog
credential_reference
=
portal_catalog
.
getResultValue
(
portal_type
=
"Credential Request"
,
reference
=
credential_reference_str
)
mail_message
=
portal_catalog
.
getResultValue
(
portal_type
=
"Mail Message"
,
follow_up
=
credential_reference
)
self
.
assertEquals
(
mail_message
.
getSimulationState
(),
"started"
)
self
.
assertTrue
(
"key=%s"
%
mail_message
.
getReference
()
in
mail_message
.
getTextContent
())
def
stepSetPreferredCredentialAlarmAutomaticCallAsFalse
(
self
,
sequence
):
sequence
.
edit
(
automatic_call
=
False
)
def
stepSetAssigneeRoleToCurrentPersonInCredentialUpdateModule
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
person_reference
=
sequence
[
"person_reference"
]
self
.
portal
.
credential_update_module
.
manage_setLocalRoles
(
person_reference
,
[
'Assignor'
,])
def
stepSetAuditorRoleToCurrentPerson
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
person_reference
=
sequence
[
"person_reference"
]
self
.
login
()
person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Person"
,
reference
=
person_reference
)
person
.
manage_setLocalRoles
(
person_reference
,
[
"Auditor"
])
self
.
logout
()
def
stepCheckPersonAfterUpdatePerson
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
reference
=
sequence
[
"person_reference"
],
portal_type
=
"Person"
)
self
.
assertEquals
(
"tom"
,
person
.
getFirstName
())
self
.
assertEquals
(
"Simpson"
,
person
.
getLastName
())
self
.
assertEquals
(
"tom@host.com"
,
person
.
getDefaultEmailText
())
def
test_01_simpleSubscriptionRequest
(
self
):
'''
'''
Check that is possible to subscribe to erp5
Check that is possible to subscribe to erp5
'''
'''
...
@@ -773,45 +867,6 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -773,45 +867,6 @@ class TestERP5Credential(ERP5TypeTestCase):
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
sequence_list
.
play
(
self
)
def
_createCredentialRequest
(
self
,
first_name
=
"Gabriel"
,
last_name
=
"Monnerat"
,
reference
=
"gabriel"
,
password
=
"123"
,
default_email_text
=
"gabriel@test.com"
):
self
.
logout
()
self
.
portal
.
ERP5Site_newCredentialRequest
(
first_name
=
first_name
,
last_name
=
last_name
,
reference
=
reference
,
password
=
password
,
career_subordination_title
=
""
,
default_email_text
=
default_email_text
,
default_telephone_text
=
"223344"
,
default_address_street_address
=
"Test Street"
,
default_address_city
=
"Campos"
,
default_address_zip_code
=
"28024030"
)
self
.
login
(
"ERP5TypeTestCase"
)
self
.
stepTic
()
def
stepCreateCredentialRequestSample
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
credential_reference
=
"credential_reference"
self
.
_createCredentialRequest
(
reference
=
credential_reference
)
sequence
.
edit
(
credential_reference
=
credential_reference
)
def
stepCheckIfMailMessageWasPosted
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
credential_reference_str
=
sequence
[
"credential_reference"
]
portal_catalog
=
self
.
portal
.
portal_catalog
credential_reference
=
portal_catalog
.
getResultValue
(
portal_type
=
"Credential Request"
,
reference
=
credential_reference_str
)
mail_message
=
portal_catalog
.
getResultValue
(
portal_type
=
"Mail Message"
,
follow_up
=
credential_reference
)
self
.
assertEquals
(
mail_message
.
getSimulationState
(),
"started"
)
self
.
assertTrue
(
"key=%s"
%
mail_message
.
getReference
()
in
mail_message
.
getTextContent
())
def
stepSetPreferredCredentialAlarmAutomaticCallAsFalse
(
self
,
sequence
):
sequence
.
edit
(
automatic_call
=
False
)
def
testMailMessagePosted
(
self
):
def
testMailMessagePosted
(
self
):
""" Test if the Mail Message was posted correctly """
""" Test if the Mail Message was posted correctly """
sequence_list
=
SequenceList
()
sequence_list
=
SequenceList
()
...
@@ -851,11 +906,31 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -851,11 +906,31 @@ class TestERP5Credential(ERP5TypeTestCase):
message_text), None)
message_text), None)
self.stepUnSetCredentialAutomaticApprovalPreferences()
self.stepUnSetCredentialAutomaticApprovalPreferences()
def testAssignmentProperties(self):
sequence = dict(automatic_call=False)
self.stepSetCredentialRequestAutomaticApprovalPreferences(sequence)
self.stepSetCredentialAssignmentPropertyList()
self._createCredentialRequest()
sequence = dict(reference="
gabriel
",
assignment_function="
member
",
assignment_role="
internal
")
self.stepCheckAssignmentAfterActiveLogin(sequence)
category_list = ["
role
/
client
", "
function
/
agent
"]
self.stepSetCredentialAssignmentPropertyList(
dict(category_list=category_list))
self._createCredentialRequest(reference="
credential_user
")
sequence = dict(reference="
credential_user
",
assignment_function="
agent
",
assignment_role="
client
")
self.stepCheckAssignmentAfterActiveLogin(sequence)
def testERP5Site_activeLogin(self):
def testERP5Site_activeLogin(self):
""" Test if the script WebSection_activeLogin will create one user
""" Test if the script WebSection_activeLogin will create one user
correctly """
correctly """
sequence = dict(automatic_call=False)
sequence = dict(automatic_call=False)
self.stepSetCredentialRequestAutomaticApprovalPreferences(sequence)
self.stepSetCredentialRequestAutomaticApprovalPreferences(sequence)
self.stepSetCredentialAssignmentPropertyList()
self.stepTic()
self._createCredentialRequest()
self._createCredentialRequest()
portal_catalog = self.portal.portal_catalog
portal_catalog = self.portal.portal_catalog
credential_request = portal_catalog.getResultValue(
credential_request = portal_catalog.getResultValue(
...
@@ -893,24 +968,6 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -893,24 +968,6 @@ class TestERP5Credential(ERP5TypeTestCase):
self.assertEquals(credential_request.getFunction(), "
member
")
self.assertEquals(credential_request.getFunction(), "
member
")
self.stepUnSetCredentialAutomaticApprovalPreferences()
self.stepUnSetCredentialAutomaticApprovalPreferences()
def testBase_getDefaultAssignmentArgumentDict(self):
sequence = dict(automatic_call=False)
self.stepSetCredentialRequestAutomaticApprovalPreferences(sequence)
self.stepSetCredentialAssignmentPropertyList()
self._createCredentialRequest()
sequence = dict(reference="
gabriel
",
assignment_function="
member
",
assignment_role="
internal
")
self.stepCheckAssignmentAfterActiveLogin(sequence)
category_list = ["
role
/
client
", "
function
/
agent
"]
self.stepSetCredentialAssignmentPropertyList(
dict(category_list=category_list))
self._createCredentialRequest(reference="
credential_user
")
sequence = dict(reference="
credential_user
",
assignment_function="
agent
",
assignment_role="
client
")
self.stepCheckAssignmentAfterActiveLogin(sequence)
def testERP5Site_newCredentialRecoveryWithNoSecurityQuestion(self):
def testERP5Site_newCredentialRecoveryWithNoSecurityQuestion(self):
"""
"""
Check that password recovery works in case if not security question with
Check that password recovery works in case if not security question with
...
@@ -919,7 +976,31 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -919,7 +976,31 @@ class TestERP5Credential(ERP5TypeTestCase):
sequence_list = SequenceList()
sequence_list = SequenceList()
sequence_string = "
CreatePerson
Tic
"
\
sequence_string = "
CreatePerson
Tic
"
\
"
RequestCredentialRecoveryWithERP5Site_newCredentialRecovery
Tic
"
\
"
RequestCredentialRecoveryWithERP5Site_newCredentialRecovery
Tic
"
\
"
CheckCredentialRecoveryCreation
"
"
CheckCredentialRecoveryCreation
"
\
"
AcceptCredentialRecovery
Tic
"
\
"
CheckEmailIsSent
Tic
"
\
"
CheckPasswordChange
"
\
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def testERP5Site_newCredentialUpdateWithNoSecurityQuestion(self):
"""
Check that password recovery works in case if not security question with
answer is defined
"""
sequence_list = SequenceList()
sequence_string = "
UnSetCredentialAutomaticApprovalPreferences
"
\
"
CreateSimpleSubscriptionRequest
Tic
"
\
"
AcceptSubscriptionRequest
Tic
"
\
"
SetAuditorRoleToCurrentPerson
"
\
"
SetAssigneeRoleToCurrentPersonInCredentialUpdateModule
Tic
"
\
"
LoginAsCurrentPersonReference
"
\
"
CreateCredentialUpdateWithERP5Site_newCredentialUpdate
Tic
"
\
"
SelectCredentialUpdate
"
\
"
AcceptCredentialUpdate
Tic
"
\
"
CheckPersonAfterUpdatePerson
"
\
sequence_list.addSequenceString(sequence_string)
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
sequence_list.play(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