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
Carlos Ramos Carreño
erp5
Commits
d1f189fc
Commit
d1f189fc
authored
Sep 02, 2020
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZODB Components: erp5_credential: Migrate Unit Test.
parent
07dedbdd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
130 additions
and
15 deletions
+130
-15
bt5/erp5_credential/TestTemplateItem/portal_components/test.erp5.testERP5Credential.py
...ateItem/portal_components/test.erp5.testERP5Credential.py
+11
-13
bt5/erp5_credential/TestTemplateItem/portal_components/test.erp5.testERP5Credential.xml
...teItem/portal_components/test.erp5.testERP5Credential.xml
+110
-0
bt5/erp5_credential/bt/template_document_id_list
bt5/erp5_credential/bt/template_document_id_list
+2
-2
bt5/erp5_credential/bt/template_test_id_list
bt5/erp5_credential/bt/template_test_id_list
+1
-0
bt5/erp5_credential/bt/test_dependency_list
bt5/erp5_credential/bt/test_dependency_list
+6
-0
No files found.
product/ERP5/tests/
testERP5Credential.py
→
bt5/erp5_credential/TestTemplateItem/portal_components/test.erp5.
testERP5Credential.py
View file @
d1f189fc
...
...
@@ -165,7 +165,7 @@ class TestERP5Credential(ERP5TypeTestCase):
self
.
_enablePreference
()
# Copied from bt5/erp5_egov/TestTemplateItem/testEGovMixin.py
def
decode_email
(
self
,
file
):
def
decode_email
(
self
,
file
_
):
# Prepare result
theMail
=
{
'attachment_list'
:
[],
...
...
@@ -174,9 +174,9 @@ class TestERP5Credential(ERP5TypeTestCase):
'headers'
:
{}
}
# Get Message
msg
=
email
.
message_from_string
(
file
)
msg
=
email
.
message_from_string
(
file
_
)
# Back up original file
theMail
[
'__original__'
]
=
file
theMail
[
'__original__'
]
=
file
_
# Recode headers to UTF-8 if needed
for
key
,
value
in
msg
.
items
():
decoded_value_list
=
decode_header
(
value
)
...
...
@@ -188,7 +188,7 @@ class TestERP5Credential(ERP5TypeTestCase):
'to'
,
'from'
,
'cc'
,
'sender'
,
'reply-to'
):
header_field
=
theMail
[
'headers'
].
get
(
header
)
if
header_field
:
theMail
[
'headers'
][
header
]
=
parseaddr
(
header_field
)[
1
]
theMail
[
'headers'
][
header
]
=
parseaddr
(
header_field
)[
1
]
# Get attachments
body_found
=
0
for
part
in
msg
.
walk
():
...
...
@@ -252,7 +252,7 @@ class TestERP5Credential(ERP5TypeTestCase):
self
.
tic
()
self
.
logout
()
def
stepSetCredentialAssignmentPropertyList
(
self
,
sequence
=
{}
):
def
stepSetCredentialAssignmentPropertyList
(
self
,
sequence
=
None
):
category_list
=
sequence
.
get
(
"category_list"
,
[
"role/internal"
,
"function/member"
])
self
.
login
()
...
...
@@ -321,8 +321,7 @@ class TestERP5Credential(ERP5TypeTestCase):
from
Products.PluggableAuthService.interfaces.plugins
import
\
IAuthenticationPlugin
uf
=
self
.
getUserFolder
()
for
plugin_name
,
plugin
in
uf
.
_getOb
(
'plugins'
).
listPlugins
(
IAuthenticationPlugin
):
for
_
,
plugin
in
uf
.
_getOb
(
'plugins'
).
listPlugins
(
IAuthenticationPlugin
):
if
plugin
.
authenticateCredentials
(
{
'login'
:
login
,
'password'
:
password
})
is
not
None
:
break
...
...
@@ -450,7 +449,6 @@ class TestERP5Credential(ERP5TypeTestCase):
self
.
_assertUserDoesNotExists
(
'homie'
,
'secret'
)
# check that informations on the person object have been updated
person_module
=
self
.
portal
.
getDefaultModule
(
'Person'
)
related_login_result
=
self
.
portal
.
portal_catalog
(
portal_type
=
'ERP5 Login'
,
reference
=
'homie'
)
self
.
assertEqual
(
len
(
related_login_result
),
1
)
related_person
=
related_login_result
[
0
].
getParentValue
()
...
...
@@ -742,7 +740,7 @@ class TestERP5Credential(ERP5TypeTestCase):
Check an email containing the usernames list as been sent
'''
person_list
=
sequence
.
get
(
'person_list'
)
email
=
sequence
.
get
(
'default_email_text'
)
email
_text
=
sequence
.
get
(
'default_email_text'
)
# after accept, only one email is send containing the reset link
previous_message
=
self
.
portal
.
MailHost
.
_previous_message
last_message
=
self
.
portal
.
MailHost
.
_last_message
...
...
@@ -760,7 +758,7 @@ class TestERP5Credential(ERP5TypeTestCase):
# check the mail is sent to the requester :
send_to
=
decoded_message
[
'headers'
][
'to'
]
self
.
assertEqual
(
email
,
send_to
)
self
.
assertEqual
(
email
_text
,
send_to
)
def
stepCheckPasswordChange
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
...
...
@@ -782,7 +780,7 @@ class TestERP5Credential(ERP5TypeTestCase):
url
=
line
[
line
.
find
(
'http:'
):]
url
=
url
.
strip
()
self
.
assertNotEquals
(
url
,
None
)
response
=
self
.
publish
(
url
)
self
.
publish
(
url
)
parameters
=
cgi
.
parse_qs
(
urlparse
.
urlparse
(
url
)[
4
])
self
.
assertTrue
(
'reset_key'
in
parameters
)
key
=
parameters
[
'reset_key'
][
0
]
...
...
@@ -1070,8 +1068,8 @@ class TestERP5Credential(ERP5TypeTestCase):
mfrom
,
mto
,
message_text
=
last_message
self
.
assertEqual
(
mfrom
,
'Portal Administrator <postmaster@localhost>'
)
self
.
assertEqual
([
'Vifib Test <barney@duff.com>'
],
mto
)
self
.
assertNotEquals
(
re
.
search
(
"Subject
\
:.*Welcome
"
, message_text), None)
self.assertNotEquals(re.search("
Hello
\
Vifib
\
Test
\
,
", message_text), None)
self
.
assertNotEquals
(
re
.
search
(
r
"Subject\
:.*Welcome
", message_text), None)
self.assertNotEquals(re.search(
r
"
Hello
\
Vifib
\
Test
\
,
", message_text), None)
decoded_message = self.decode_email(last_message[2])
body_message = decoded_message['body']
self.assertNotEquals(re.search("
key
=%
s
" % mail_message.getReference(),
...
...
bt5/erp5_credential/TestTemplateItem/portal_components/test.erp5.testERP5Credential.xml
0 → 100644
View file @
d1f189fc
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Test Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testERP5Credential
</string>
</value>
</item>
<item>
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.tests.testERP5Credential
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testERP5Credential
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Test Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_credential/bt/template_document_id_list
View file @
d1f189fc
document.erp5.CredentialRequest
document.erp5.CredentialRecovery
\ No newline at end of file
document.erp5.CredentialRecovery
document.erp5.CredentialRequest
\ No newline at end of file
bt5/erp5_credential/bt/template_test_id_list
0 → 100644
View file @
d1f189fc
test.erp5.testERP5Credential
\ No newline at end of file
bt5/erp5_credential/bt/test_dependency_list
0 → 100644
View file @
d1f189fc
erp5_full_text_mroonga_catalog
erp5_core_proxy_field_legacy
erp5_jquery
erp5_ingestion_mysql_innodb_catalog
erp5_ingestion
erp5_administration
\ No newline at end of file
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