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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Vincent Bechu
erp5
Commits
7f486435
Commit
7f486435
authored
May 17, 2018
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_interface_post: test that Entity_sendEmail can retry on failure
But only one mail will be sent out by MailHost
parent
e8c4f503
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
bt5/erp5_interface_post/TestTemplateItem/portal_components/test.erp5.testInterfacePost.py
...lateItem/portal_components/test.erp5.testInterfacePost.py
+45
-0
No files found.
bt5/erp5_interface_post/TestTemplateItem/portal_components/test.erp5.testInterfacePost.py
View file @
7f486435
...
@@ -28,6 +28,7 @@ import email
...
@@ -28,6 +28,7 @@ import email
import
time
import
time
from
Products.ERP5Type.tests.ERP5TypeLiveTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeLiveTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
,
removeZODBPythonScript
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
from
DateTime
import
DateTime
from
DateTime
import
DateTime
...
@@ -81,6 +82,14 @@ class TestInterfacePost(ERP5TypeTestCase):
...
@@ -81,6 +82,14 @@ class TestInterfacePost(ERP5TypeTestCase):
module
=
getattr
(
self
.
portal
,
module_id
)
module
=
getattr
(
self
.
portal
,
module_id
)
module
.
manage_delObjects
(
list
(
module
.
objectIds
()))
module
.
manage_delObjects
(
list
(
module
.
objectIds
()))
custom_skin
=
self
.
portal
.
portal_skins
.
custom
if
'Entity_sendEmail'
in
custom_skin
.
objectIds
():
removeZODBPythonScript
(
custom_skin
,
'Entity_sendEmail'
,
)
self
.
commit
()
def
_portal_catalog
(
self
,
**
kw
):
def
_portal_catalog
(
self
,
**
kw
):
result_list
=
self
.
portal
.
portal_catalog
(
**
kw
)
result_list
=
self
.
portal
.
portal_catalog
(
**
kw
)
uid_list
=
[
x
.
uid
for
x
in
result_list
]
uid_list
=
[
x
.
uid
for
x
in
result_list
]
...
@@ -333,6 +342,21 @@ class TestInterfacePost(ERP5TypeTestCase):
...
@@ -333,6 +342,21 @@ class TestInterfacePost(ERP5TypeTestCase):
pdf_document
,
=
pdf_document_list
pdf_document
,
=
pdf_document_list
self
.
assertEqual
(
2
,
int
(
pdf_document
.
getContentInformation
()[
'Pages'
]))
self
.
assertEqual
(
2
,
int
(
pdf_document
.
getContentInformation
()[
'Pages'
]))
def
stepMakeEntitySendEmailFailOnce
(
self
,
sequence
=
None
):
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
'Entity_sendEmail'
,
self
.
portal
.
Entity_sendEmail
.
params
(),
"""portal = context.getPortalObject()
for activity in portal.portal_activities.getMessageList():
if activity.method_id == script.id:
if activity.retry == 0:
raise ValueError('Failure on purpose')
else:
return context.skinSuper('custom', script.id)(%s)"""
%
(
self
.
portal
.
Entity_sendEmail
.
params
(),)
)
def
test_emailSendingIsPilotedByInternetMessagePost
(
self
):
def
test_emailSendingIsPilotedByInternetMessagePost
(
self
):
"""
"""
"""
"""
...
@@ -392,6 +416,27 @@ class TestInterfacePost(ERP5TypeTestCase):
...
@@ -392,6 +416,27 @@ class TestInterfacePost(ERP5TypeTestCase):
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
sequence_list
.
play
(
self
)
def
test_Entity_sendEmailCanRaiseOnceWithoutSpammingRecipient
(
self
):
"""
Entity_sendEmail used to be launched in an activity with retry_max=0 and
retry_conflict=False. But now that it creates Internet Message Posts, it
should be able to retry on ConflictError. We should also make sure that
in this case the mail isn't sent (as MailHost isn't transactional)
"""
sequence_list
=
SequenceList
()
sequence_string
=
"""
stepMakeEntitySendEmailFailOnce
stepCreateMailMessage
stepStartMailMessage
stepCheckMailMessage
stepTic
stepCheckInternetMessagePostCreated
stepCheckOnlyOneMessageHasBeenSentFromMailHost
stepCheckLatestMessageListFromMailHost
"""
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
def
test_ingestedInternetMessagePostCreateMailMessageWithCausality
(
self
):
def
test_ingestedInternetMessagePostCreateMailMessageWithCausality
(
self
):
sequence_list
=
SequenceList
()
sequence_list
=
SequenceList
()
sequence_string
=
"""
sequence_string
=
"""
...
...
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