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
Yusei Tahara
erp5
Commits
9d9df4fe
Commit
9d9df4fe
authored
Apr 15, 2021
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! mixin/mail_message: more robust algorythm to choose the first preferred text format part.
parent
0b16a659
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
145 additions
and
2 deletions
+145
-2
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCRM.py
...m/TestTemplateItem/portal_components/test.erp5.testCRM.py
+10
-2
product/ERP5/tests/test_data/gmail.eml
product/ERP5/tests/test_data/gmail.eml
+35
-0
product/ERP5/tests/test_data/outlook.eml
product/ERP5/tests/test_data/outlook.eml
+55
-0
product/ERP5/tests/test_data/roundcube.eml
product/ERP5/tests/test_data/roundcube.eml
+45
-0
No files found.
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCRM.py
View file @
9d9df4fe
...
@@ -1018,8 +1018,7 @@ class TestCRMMailIngestion(BaseTestCRM):
...
@@ -1018,8 +1018,7 @@ class TestCRMMailIngestion(BaseTestCRM):
part
.
set_payload
(
html_message
)
part
.
set_payload
(
html_message
)
encoders
.
encode_base64
(
part
)
encoders
.
encode_base64
(
part
)
part
.
add_header
(
'Content-Disposition'
,
'attachment'
,
part
.
add_header
(
'Content-Disposition'
,
'attachment'
)
filename
=
html_filename
)
part
.
add_header
(
'Content-ID'
,
'<%s>'
%
\
part
.
add_header
(
'Content-ID'
,
'<%s>'
%
\
''
.
join
([
'%s'
%
ord
(
i
)
for
i
in
html_filename
]))
''
.
join
([
'%s'
%
ord
(
i
)
for
i
in
html_filename
]))
message
.
attach
(
part
)
message
.
attach
(
part
)
...
@@ -1030,6 +1029,15 @@ class TestCRMMailIngestion(BaseTestCRM):
...
@@ -1030,6 +1029,15 @@ class TestCRMMailIngestion(BaseTestCRM):
self
.
assertTrue
(
bool
(
event
.
getAttachmentData
(
1
)))
self
.
assertTrue
(
bool
(
event
.
getAttachmentData
(
1
)))
self
.
assertTrue
(
bool
(
event
.
getAttachmentData
(
2
)))
self
.
assertTrue
(
bool
(
event
.
getAttachmentData
(
2
)))
def
test_getMessageTextPart
(
self
):
portal_type
=
'Mail Message'
event
=
self
.
portal
.
getDefaultModule
(
portal_type
).
newContent
(
portal_type
=
portal_type
)
for
filename
in
(
'gmail.eml'
,
'outlook.eml'
,
'roundcube.eml'
):
file_path
=
'%s/test_data/%s'
%
(
os
.
path
.
dirname
(
Products
.
ERP5
.
tests
.
__file__
),
filename
)
event
.
setData
(
open
(
file_path
).
read
())
self
.
assertTrue
(
event
.
getTextContent
().
startswith
(
'<'
))
...
...
product/ERP5/tests/test_data/gmail.eml
0 → 100644
View file @
9d9df4fe
MIME-Version: 1.0
From: Test <test@gmail.com>
Date: Thu, 15 Apr 2021 10:32:20 +0200
Message-ID: <CALqEfxfJAfJd5qHTKo0=bAp75PBPBuDLzqtLNvTVhvOYhRt_DA@mail.gmail.com>
Subject: test gmail
To: Test <test@nexedi.com>
Content-Type: multipart/mixed; boundary="0000000000005ee8f605bffeb4d1"
--0000000000005ee8f605bffeb4d1
Content-Type: multipart/alternative; boundary="0000000000005ee8f305bffeb4cf"
--0000000000005ee8f305bffeb4cf
Content-Type: text/plain; charset="UTF-8"
test gmail
--0000000000005ee8f305bffeb4cf
Content-Type: text/html; charset="UTF-8"
<div dir="ltr">test gmail</div>
--0000000000005ee8f305bffeb4cf--
--0000000000005ee8f605bffeb4d1
Content-Type: image/png; name="white.png"
Content-Disposition: attachment; filename="white.png"
Content-Transfer-Encoding: base64
Content-ID: <f_knimjntc1>
X-Attachment-Id: f_knimjntc1
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQAAAAA3iMLMAAAABGdBTUEAALGPC/xhBQAAACBjSFJN
AAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAd2KE6QAAAAHdElN
RQflBA8MHjIyMgE8AAAADklEQVQI12P4/5+BFAQA/U4f4XOLpqwAAAAldEVYdGRhdGU6Y3JlYXRl
ADIwMjEtMDQtMTVUMTA6MzA6NTArMDI6MDDpJ1gdAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIxLTA0
LTE1VDEwOjMwOjUwKzAyOjAwmHrgoQAAAABJRU5ErkJggg==
--0000000000005ee8f605bffeb4d1--
product/ERP5/tests/test_data/outlook.eml
0 → 100644
View file @
9d9df4fe
From: Test
<test
@
outlook
.
com
>
To: Test
<test
@
nexedi
.
com
>
Subject: test outlook
Date: Thu, 15 Apr 2021 08:33:31 +0000
Message-ID:
<PA4PR06MB7264A7A59948017041BDACC6EB4D9
@
PA4PR06MB7264
.
eurprd06
.
prod
.
outlook
.
com
>
Content-Type: multipart/mixed;
boundary="_004_PA4PR06MB7264A7A59948017041BDACC6EB4D9PA4PR06MB7264eurp_"
MIME-Version: 1.0
--_004_PA4PR06MB7264A7A59948017041BDACC6EB4D9PA4PR06MB7264eurp_
Content-Type: multipart/alternative;
boundary="_000_PA4PR06MB7264A7A59948017041BDACC6EB4D9PA4PR06MB7264eurp_"
--_000_PA4PR06MB7264A7A59948017041BDACC6EB4D9PA4PR06MB7264eurp_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
test outlook
--_000_PA4PR06MB7264A7A59948017041BDACC6EB4D9PA4PR06MB7264eurp_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta
http-equiv=
3D"Content-Type"
content=
3D"text/html;
charset=
3Diso-8859-=
1
"
>
<style
type=
3D"text/css"
style=
3D"display:none;"
>
P
{
margin-top
:
0
;
margin-bo=
ttom
:
0
;}
</style>
</head>
<body
dir=
3D"ltr"
>
<div
style=
3D"font-family:
Calibri
,
Arial
,
Helvetica
,
sans-serif
;
font-size=
:
12pt
;
color:
rgb
(
0
,
0
,
0
);"
>
test outlook
</div>
</body>
</html>
--_000_PA4PR06MB7264A7A59948017041BDACC6EB4D9PA4PR06MB7264eurp_--
--_004_PA4PR06MB7264A7A59948017041BDACC6EB4D9PA4PR06MB7264eurp_
Content-Type: image/png; name="white.png"
Content-Description: white.png
Content-Disposition: attachment; filename="white.png"; size=262;
creation-date="Thu, 15 Apr 2021 08:33:28 GMT";
modification-date="Thu, 15 Apr 2021 08:33:31 GMT"
Content-Transfer-Encoding: base64
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQAAAAA3iMLMAAAABGdBTUEAALGPC/xhBQAAACBjSFJN
AAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAd2KE6QAAAAHdElN
RQflBA8MHjIyMgE8AAAADklEQVQI12P4/5+BFAQA/U4f4XOLpqwAAAAldEVYdGRhdGU6Y3JlYXRl
ADIwMjEtMDQtMTVUMTA6MzA6NTArMDI6MDDpJ1gdAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIxLTA0
LTE1VDEwOjMwOjUwKzAyOjAwmHrgoQAAAABJRU5ErkJggg==
--_004_PA4PR06MB7264A7A59948017041BDACC6EB4D9PA4PR06MB7264eurp_--
product/ERP5/tests/test_data/roundcube.eml
0 → 100644
View file @
9d9df4fe
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="=_862f70c5d3ae68efda7d386a6a83a8a5"
Date: Thu, 15 Apr 2021 10:49:41 +0200
From: test@nexedi.com
To: test@nexedi.com
Subject: test roundcube
Message-ID:
<c4c34fcc792479e9bdeea46560650b93
@
nexedi
.
com
>
--=_862f70c5d3ae68efda7d386a6a83a8a5
Content-Type: multipart/alternative;
boundary="=_06ce16e9fb6dfa7ad799171afb2d6cda"
--=_06ce16e9fb6dfa7ad799171afb2d6cda
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII
test roundcube
--=_06ce16e9fb6dfa7ad799171afb2d6cda
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8
<html><head><meta
http-equiv=
3D"Content-Type"
content=
3D"text/html;
charset=
=3DUTF-8"
/></head><body
style=
3D'font-size:
10pt
;
font-family:
Verdana
,
Gen=
eva,sans-serif'
>
<p>
test roundcube
</p>
</body></html>
--=_06ce16e9fb6dfa7ad799171afb2d6cda--
--=_862f70c5d3ae68efda7d386a6a83a8a5
Content-Transfer-Encoding: base64
Content-Type: image/png;
name=white.png
Content-Disposition: attachment;
filename=white.png;
size=262
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQAAAAA3iMLMAAAABGdBTUEAALGPC/xhBQAAACBjSFJN
AAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAd2KE6QAAAAHdElN
RQflBA8MHjIyMgE8AAAADklEQVQI12P4/5+BFAQA/U4f4XOLpqwAAAAldEVYdGRhdGU6Y3JlYXRl
ADIwMjEtMDQtMTVUMTA6MzA6NTArMDI6MDDpJ1gdAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIxLTA0
LTE1VDEwOjMwOjUwKzAyOjAwmHrgoQAAAABJRU5ErkJggg==
--=_862f70c5d3ae68efda7d386a6a83a8a5--
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