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
900978cc
Commit
900978cc
authored
Apr 18, 2024
by
Carlos Ramos Carreño
Committed by
Jérome Perrin
May 09, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix encode/decode.
parent
91602d53
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
bt5/erp5_interface_post/TestTemplateItem/portal_components/test.erp5.testInterfacePost.py
...lateItem/portal_components/test.erp5.testInterfacePost.py
+5
-4
No files found.
bt5/erp5_interface_post/TestTemplateItem/portal_components/test.erp5.testInterfacePost.py
View file @
900978cc
...
@@ -37,6 +37,7 @@ else:
...
@@ -37,6 +37,7 @@ else:
from
Products.ERP5Type.tests.ERP5TypeLiveTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeLiveTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5Type.Utils
import
bytes2str
,
str2bytes
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
from
DateTime
import
DateTime
from
DateTime
import
DateTime
...
@@ -238,7 +239,7 @@ class TestInterfacePost(ERP5TypeTestCase):
...
@@ -238,7 +239,7 @@ class TestInterfacePost(ERP5TypeTestCase):
for
internet_message_post
in
internet_message_post_list
:
for
internet_message_post
in
internet_message_post_list
:
self
.
assertEqual
(
internet_message_post
.
getSimulationState
(),
'exported'
)
self
.
assertEqual
(
internet_message_post
.
getSimulationState
(),
'exported'
)
mail_object
=
email
.
message_from_string
(
internet_message_post
.
getData
().
decode
(
))
mail_object
=
email
.
message_from_string
(
bytes2str
(
internet_message_post
.
getData
()
))
self
.
assertEqual
(
self
.
assertEqual
(
internet_message_post
.
getReference
(),
mail_object
[
'message-id'
].
strip
(
'<>'
)
internet_message_post
.
getReference
(),
mail_object
[
'message-id'
].
strip
(
'<>'
)
)
)
...
@@ -273,7 +274,7 @@ class TestInterfacePost(ERP5TypeTestCase):
...
@@ -273,7 +274,7 @@ class TestInterfacePost(ERP5TypeTestCase):
message_list
=
self
.
portal
.
MailHost
.
_message_list
message_list
=
self
.
portal
.
MailHost
.
_message_list
self
.
assertEqual
(
len
(
message_list
),
len
(
self
.
recipient_list
))
self
.
assertEqual
(
len
(
message_list
),
len
(
self
.
recipient_list
))
for
post
in
sequence
[
'internet_message_post_list'
]:
for
post
in
sequence
[
'internet_message_post_list'
]:
post_recipient
=
email
.
message_from_string
(
post
.
getData
().
decode
(
))[
'to'
]
post_recipient
=
email
.
message_from_string
(
bytes2str
(
post
.
getData
()
))[
'to'
]
message_list
=
self
.
_getMailHostMessageForRecipient
(
post_recipient
)
message_list
=
self
.
_getMailHostMessageForRecipient
(
post_recipient
)
self
.
assertEqual
(
len
(
message_list
),
1
)
self
.
assertEqual
(
len
(
message_list
),
1
)
message
=
message_list
[
0
]
message
=
message_list
[
0
]
...
@@ -295,7 +296,7 @@ class TestInterfacePost(ERP5TypeTestCase):
...
@@ -295,7 +296,7 @@ class TestInterfacePost(ERP5TypeTestCase):
post
=
sequence
[
'internet_message_post'
]
post
=
sequence
[
'internet_message_post'
]
# Create a response mail object
# Create a response mail object
mail_object
=
email
.
message_from_string
(
post
.
getData
().
decode
(
))
mail_object
=
email
.
message_from_string
(
bytes2str
(
post
.
getData
()
))
sender
=
mail_object
[
'from'
]
sender
=
mail_object
[
'from'
]
recipient
=
mail_object
[
'to'
]
recipient
=
mail_object
[
'to'
]
...
@@ -310,7 +311,7 @@ class TestInterfacePost(ERP5TypeTestCase):
...
@@ -310,7 +311,7 @@ class TestInterfacePost(ERP5TypeTestCase):
# Ingest it
# Ingest it
response_post
=
self
.
portal
.
internet_message_post_module
.
newContent
(
response_post
=
self
.
portal
.
internet_message_post_module
.
newContent
(
portal_type
=
'Internet Message Post'
,
portal_type
=
'Internet Message Post'
,
data
=
mail_object
.
as_string
().
encode
(
),
data
=
str2bytes
(
mail_object
.
as_string
()
),
)
)
response_post
.
prepareImport
()
response_post
.
prepareImport
()
sequence
[
'internet_message_post_response'
]
=
response_post
sequence
[
'internet_message_post_response'
]
=
response_post
...
...
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