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
Paul Graydon
erp5
Commits
98a514b8
Commit
98a514b8
authored
Mar 20, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CRM: py3 WIP
parent
52b45447
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
20 deletions
+21
-20
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCRM.py
...m/TestTemplateItem/portal_components/test.erp5.testCRM.py
+21
-20
No files found.
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCRM.py
View file @
98a514b8
...
@@ -711,7 +711,8 @@ class TestCRMMailIngestion(BaseTestCRM):
...
@@ -711,7 +711,8 @@ class TestCRMMailIngestion(BaseTestCRM):
def
_readTestData
(
self
,
filename
):
def
_readTestData
(
self
,
filename
):
"""read test data from data directory."""
"""read test data from data directory."""
return
open
(
makeFilePath
(
filename
)).
read
()
with
open
(
makeFilePath
(
filename
),
'rb'
)
as
f
:
return
f
.
read
()
def
_ingestMail
(
self
,
filename
=
None
,
data
=
None
):
def
_ingestMail
(
self
,
filename
=
None
,
data
=
None
):
"""ingest an email from the mail in data dir named `filename`"""
"""ingest an email from the mail in data dir named `filename`"""
...
@@ -1306,7 +1307,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1306,7 +1307,7 @@ class TestCRMMailSend(BaseTestCRM):
for
i
in
message
.
get_payload
():
for
i
in
message
.
get_payload
():
if
i
.
get_content_type
()
==
'text/plain'
:
if
i
.
get_content_type
()
==
'text/plain'
:
part
=
i
part
=
i
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
),
event
.
getTextContent
())
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
)
.
decode
()
,
event
.
getTextContent
())
# Check attachment
# Check attachment
# pdf
# pdf
...
@@ -1316,7 +1317,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1316,7 +1317,7 @@ class TestCRMMailSend(BaseTestCRM):
for
i
in
message
.
get_payload
():
for
i
in
message
.
get_payload
():
if
i
.
get_filename
()
==
filename
:
if
i
.
get_filename
()
==
filename
:
part
=
i
part
=
i
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
),
str
(
document
.
getData
()))
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
),
bytes
(
document
.
getData
()))
def
test_MailAttachmentText
(
self
):
def
test_MailAttachmentText
(
self
):
"""
"""
...
@@ -1353,7 +1354,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1353,7 +1354,7 @@ class TestCRMMailSend(BaseTestCRM):
for
i
in
message
.
get_payload
():
for
i
in
message
.
get_payload
():
if
i
.
get_content_type
()
==
'text/plain'
:
if
i
.
get_content_type
()
==
'text/plain'
:
part
=
i
part
=
i
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
),
event
.
getTextContent
())
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
)
.
decode
()
,
event
.
getTextContent
())
# Check attachment
# Check attachment
# odt
# odt
...
@@ -1398,7 +1399,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1398,7 +1399,7 @@ class TestCRMMailSend(BaseTestCRM):
for
i
in
message
.
get_payload
():
for
i
in
message
.
get_payload
():
if
i
.
get_content_type
()
==
'text/plain'
:
if
i
.
get_content_type
()
==
'text/plain'
:
part
=
i
part
=
i
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
),
event
.
getTextContent
())
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
)
.
decode
()
,
event
.
getTextContent
())
# Check attachment
# Check attachment
# zip
# zip
...
@@ -1445,7 +1446,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1445,7 +1446,7 @@ class TestCRMMailSend(BaseTestCRM):
for
i
in
message
.
get_payload
():
for
i
in
message
.
get_payload
():
if
i
.
get_content_type
()
==
'text/plain'
:
if
i
.
get_content_type
()
==
'text/plain'
:
part
=
i
part
=
i
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
),
event
.
getTextContent
())
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
)
.
decode
()
,
event
.
getTextContent
())
# Check attachment
# Check attachment
# gif
# gif
...
@@ -1455,7 +1456,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1455,7 +1456,7 @@ class TestCRMMailSend(BaseTestCRM):
for
i
in
message
.
get_payload
():
for
i
in
message
.
get_payload
():
if
i
.
get_filename
()
==
filename
:
if
i
.
get_filename
()
==
filename
:
part
=
i
part
=
i
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
),
str
(
document
.
getData
()))
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
),
bytes
(
document
.
getData
()))
def
test_MailAttachmentWebPage
(
self
):
def
test_MailAttachmentWebPage
(
self
):
"""
"""
...
@@ -1464,7 +1465,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1464,7 +1465,7 @@ class TestCRMMailSend(BaseTestCRM):
# Add a document which will be attached.
# Add a document which will be attached.
filename
=
'sample_attachment.html'
filename
=
'sample_attachment.html'
document
=
self
.
portal
.
portal_contributions
.
newContent
(
document
=
self
.
portal
.
portal_contributions
.
newContent
(
data
=
'<html><body>Hello world!</body></html>'
,
data
=
b
'<html><body>Hello world!</body></html>'
,
filename
=
filename
)
filename
=
filename
)
self
.
tic
()
self
.
tic
()
...
@@ -1492,7 +1493,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1492,7 +1493,7 @@ class TestCRMMailSend(BaseTestCRM):
for
i
in
message
.
get_payload
():
for
i
in
message
.
get_payload
():
if
i
.
get_content_type
()
==
'text/plain'
:
if
i
.
get_content_type
()
==
'text/plain'
:
part
=
i
part
=
i
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
),
event
.
getTextContent
())
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
)
.
decode
()
,
event
.
getTextContent
())
# Check attachment
# Check attachment
# html
# html
...
@@ -1503,7 +1504,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1503,7 +1504,7 @@ class TestCRMMailSend(BaseTestCRM):
if
i
.
get_filename
()
==
filename
:
if
i
.
get_filename
()
==
filename
:
part
=
i
part
=
i
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
),
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
),
str
(
document
.
getTextContent
()
))
document
.
getTextContent
(
))
self
.
assertEqual
(
part
.
get_content_type
(),
'text/html'
)
self
.
assertEqual
(
part
.
get_content_type
(),
'text/html'
)
def
test_AttachPdfToMailUsingNewEventDialog
(
self
):
def
test_AttachPdfToMailUsingNewEventDialog
(
self
):
...
@@ -1543,7 +1544,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1543,7 +1544,7 @@ class TestCRMMailSend(BaseTestCRM):
for
i
in
message
.
get_payload
():
for
i
in
message
.
get_payload
():
if
i
.
get_content_type
()
==
'text/plain'
:
if
i
.
get_content_type
()
==
'text/plain'
:
part
=
i
part
=
i
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
),
event
.
getTextContent
())
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
)
.
decode
()
,
event
.
getTextContent
())
# Check attachment
# Check attachment
# pdf
# pdf
...
@@ -1553,7 +1554,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1553,7 +1554,7 @@ class TestCRMMailSend(BaseTestCRM):
for
i
in
message
.
get_payload
():
for
i
in
message
.
get_payload
():
if
i
.
get_filename
()
==
filename
:
if
i
.
get_filename
()
==
filename
:
part
=
i
part
=
i
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
),
str
(
document
.
getData
()))
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
),
bytes
(
document
.
getData
()))
def
test_AttachFileToMailUsingNewEventDialog
(
self
):
def
test_AttachFileToMailUsingNewEventDialog
(
self
):
"""
"""
...
@@ -1591,7 +1592,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1591,7 +1592,7 @@ class TestCRMMailSend(BaseTestCRM):
for
i
in
message
.
get_payload
():
for
i
in
message
.
get_payload
():
if
i
.
get_content_type
()
==
'text/plain'
:
if
i
.
get_content_type
()
==
'text/plain'
:
part
=
i
part
=
i
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
),
event
.
getTextContent
())
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
)
.
decode
()
,
event
.
getTextContent
())
# Check attachment
# Check attachment
# zip
# zip
...
@@ -1605,7 +1606,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1605,7 +1606,7 @@ class TestCRMMailSend(BaseTestCRM):
def
test_testValidatorForAttachmentField
(
self
):
def
test_testValidatorForAttachmentField
(
self
):
"""
"""
If an Event Type doesn't allow Em
e
bedded Files in its sub portal types,
If an Event Type doesn't allow Embedded Files in its sub portal types,
then the dialog should tell the user that attachment can't be uploaded
then the dialog should tell the user that attachment can't be uploaded
"""
"""
# Add a document which will be attached.
# Add a document which will be attached.
...
@@ -1723,7 +1724,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1723,7 +1724,7 @@ class TestCRMMailSend(BaseTestCRM):
if
i
.
get_content_type
()
==
'text/plain'
:
if
i
.
get_content_type
()
==
'text/plain'
:
part
=
i
part
=
i
break
break
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
),
event
.
getTextContent
())
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
)
.
decode
()
,
event
.
getTextContent
())
# Check attachment
# Check attachment
# txt
# txt
...
@@ -1780,7 +1781,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1780,7 +1781,7 @@ class TestCRMMailSend(BaseTestCRM):
for
i
in
message
.
get_payload
():
for
i
in
message
.
get_payload
():
if
i
.
get_content_type
()
==
'text/plain'
:
if
i
.
get_content_type
()
==
'text/plain'
:
part
=
i
part
=
i
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
),
event
.
getTextContent
())
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
)
.
decode
()
,
event
.
getTextContent
())
# Check attachment
# Check attachment
# gif
# gif
...
@@ -1790,11 +1791,11 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1790,11 +1791,11 @@ class TestCRMMailSend(BaseTestCRM):
for
i
in
message
.
get_payload
():
for
i
in
message
.
get_payload
():
if
i
.
get_filename
()
==
filename
:
if
i
.
get_filename
()
==
filename
:
part
=
i
part
=
i
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
),
str
(
document_gif
.
getData
()))
self
.
assertEqual
(
part
.
get_payload
(
decode
=
True
),
bytes
(
document_gif
.
getData
()))
def
test_cloneEvent
(
self
):
def
test_cloneEvent
(
self
):
"""
"""
All events uses after script and interac
it
on
All events uses after script and interac
ti
on
workflow add a test for clone
workflow add a test for clone
"""
"""
# XXX in the case of title, getTitle ignores the title attribute,
# XXX in the case of title, getTitle ignores the title attribute,
...
@@ -1827,7 +1828,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1827,7 +1828,7 @@ class TestCRMMailSend(BaseTestCRM):
def
test_cloneTicketAndEventList
(
self
):
def
test_cloneTicketAndEventList
(
self
):
"""
"""
All events uses after script and interac
it
on
All events uses after script and interac
ti
on
workflow add a test for clone
workflow add a test for clone
"""
"""
portal
=
self
.
portal
portal
=
self
.
portal
...
@@ -2053,7 +2054,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -2053,7 +2054,7 @@ class TestCRMMailSend(BaseTestCRM):
attachment_list
=
[])
attachment_list
=
[])
self
.
tic
()
self
.
tic
()
(
from_url
,
to_url
,
last_message
,),
=
self
.
portal
.
MailHost
.
_message_list
(
from_url
,
to_url
,
last_message
,),
=
self
.
portal
.
MailHost
.
_message_list
self
.
assertIn
(
"Body Simple Case"
,
last_message
)
self
.
assertIn
(
b
"Body Simple Case"
,
last_message
)
self
.
assertEqual
(
'FG ER <eee@eee.com>'
,
from_url
)
self
.
assertEqual
(
'FG ER <eee@eee.com>'
,
from_url
)
self
.
assertEqual
([
'Expert User <expert@in24.test>'
],
to_url
)
self
.
assertEqual
([
'Expert User <expert@in24.test>'
],
to_url
)
...
...
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