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
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
Sebastian
erp5
Commits
0d34c03a
Commit
0d34c03a
authored
Dec 20, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CRM: test we send only one email
parent
33d27b15
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
13 deletions
+15
-13
product/ERP5/tests/testCRM.py
product/ERP5/tests/testCRM.py
+12
-9
product/ERP5/tests/testNotificationTool.py
product/ERP5/tests/testNotificationTool.py
+3
-4
No files found.
product/ERP5/tests/testCRM.py
View file @
0d34c03a
...
@@ -1030,7 +1030,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1030,7 +1030,7 @@ class TestCRMMailSend(BaseTestCRM):
event
.
setTextContent
(
text_content
)
event
.
setTextContent
(
text_content
)
self
.
portal
.
portal_workflow
.
doActionFor
(
event
,
'start_action'
)
self
.
portal
.
portal_workflow
.
doActionFor
(
event
,
'start_action'
)
self
.
tic
()
self
.
tic
()
last_message
=
self
.
portal
.
MailHost
.
_last_message
last_message
,
=
self
.
portal
.
MailHost
.
_message_list
self
.
assertNotEquals
((),
last_message
)
self
.
assertNotEquals
((),
last_message
)
mfrom
,
mto
,
messageText
=
last_message
mfrom
,
mto
,
messageText
=
last_message
self
.
assertEquals
(
'"Me," <me@erp5.org>'
,
mfrom
)
self
.
assertEquals
(
'"Me," <me@erp5.org>'
,
mfrom
)
...
@@ -1097,6 +1097,7 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1097,6 +1097,7 @@ class TestCRMMailSend(BaseTestCRM):
self
.
tic
()
self
.
tic
()
# this means no message have been set
# this means no message have been set
self
.
assertEquals
([],
self
.
portal
.
MailHost
.
_message_list
)
self
.
assertEquals
((),
self
.
portal
.
MailHost
.
_last_message
)
self
.
assertEquals
((),
self
.
portal
.
MailHost
.
_last_message
)
def
test_MailMessageHTML
(
self
):
def
test_MailMessageHTML
(
self
):
...
@@ -1786,21 +1787,23 @@ class TestCRMMailSend(BaseTestCRM):
...
@@ -1786,21 +1787,23 @@ class TestCRMMailSend(BaseTestCRM):
last_message_date
=
DateTime
(
message
.
get
(
"Date"
))
last_message_date
=
DateTime
(
message
.
get
(
"Date"
))
self
.
assertTrue
(
last_message_date
.
isCurrentDay
())
self
.
assertTrue
(
last_message_date
.
isCurrentDay
())
def
test_MailMessage_
Event_
send_simple_case
(
self
):
def
test_MailMessage_send_simple_case
(
self
):
"""
"""
Check that the
script Event_
send send one email passing all parameters directly
Check that the
method
send send one email passing all parameters directly
from_url, to_url, reply_url, subject, body, attachment_format, attachment_list
from_url, to_url, reply_url, subject, body, attachment_format, attachment_list
"""
"""
mail_message
=
self
.
portal
.
event_module
.
newContent
(
portal_type
=
"Mail Message"
)
mail_message
=
self
.
portal
.
event_module
.
newContent
(
portal_type
=
"Mail Message"
)
self
.
tic
()
self
.
tic
()
mail_message
.
Event_
send
(
from_url
=
'FG ER <eee@eee.com>'
,
mail_message
.
send
(
from_url
=
'FG ER <eee@eee.com>'
,
to_url
=
'Expert User <expert@in24.test>'
,
to_url
=
'Expert User <expert@in24.test>'
,
subject
=
"Simple Case"
,
subject
=
"Simple Case"
,
body
=
"Body Simple Case"
,
body
=
"Body Simple Case"
,
attachment_list
=
[])
attachment_list
=
[])
self
.
tic
()
self
.
tic
()
last_message
=
self
.
portal
.
MailHost
.
_last_message
[
-
1
]
(
from_url
,
to_url
,
last_message
,),
=
self
.
portal
.
MailHost
.
_message_list
self
.
assertTrue
(
"Body Simple Case"
in
last_message
)
self
.
assertTrue
(
"Body Simple Case"
in
last_message
)
self
.
assertEquals
(
'FG ER <eee@eee.com>'
,
from_url
)
self
.
assertEquals
([
'Expert User <expert@in24.test>'
],
to_url
)
def
test_suite
():
def
test_suite
():
...
...
product/ERP5/tests/testNotificationTool.py
View file @
0d34c03a
...
@@ -125,6 +125,7 @@ class TestNotificationTool(ERP5TypeTestCase):
...
@@ -125,6 +125,7 @@ class TestNotificationTool(ERP5TypeTestCase):
if
'MailHost'
in
portal
.
objectIds
():
if
'MailHost'
in
portal
.
objectIds
():
portal
.
manage_delObjects
([
'MailHost'
])
portal
.
manage_delObjects
([
'MailHost'
])
portal
.
_setObject
(
'MailHost'
,
DummyMailHost
(
'MailHost'
))
portal
.
_setObject
(
'MailHost'
,
DummyMailHost
(
'MailHost'
))
self
.
portal
.
MailHost
.
reset
()
portal
.
email_from_address
=
'site@example.invalid'
portal
.
email_from_address
=
'site@example.invalid'
self
.
portal
.
portal_caches
.
clearAllCache
()
self
.
portal
.
portal_caches
.
clearAllCache
()
self
.
tic
()
self
.
tic
()
...
@@ -464,8 +465,7 @@ Yes, I will go."""
...
@@ -464,8 +465,7 @@ Yes, I will go."""
self
.
portal
.
portal_notifications
.
sendMessage
(
self
.
portal
.
portal_notifications
.
sendMessage
(
recipient
=
'userA'
,
subject
=
'Subject'
,
recipient
=
'userA'
,
subject
=
'Subject'
,
message_text_format
=
'text/html'
,
message
=
message
)
message_text_format
=
'text/html'
,
message
=
message
)
last_message
=
self
.
portal
.
MailHost
.
_last_message
last_message
,
=
self
.
portal
.
MailHost
.
_message_list
self
.
assertNotEquals
((),
last_message
)
mfrom
,
mto
,
messageText
=
last_message
mfrom
,
mto
,
messageText
=
last_message
self
.
assertEquals
(
'Portal Administrator <site@example.invalid>'
,
mfrom
)
self
.
assertEquals
(
'Portal Administrator <site@example.invalid>'
,
mfrom
)
self
.
assertEquals
([
'userA@example.invalid'
],
mto
)
self
.
assertEquals
([
'userA@example.invalid'
],
mto
)
...
@@ -514,8 +514,7 @@ class TestNotificationToolWithCRM(TestNotificationTool):
...
@@ -514,8 +514,7 @@ class TestNotificationToolWithCRM(TestNotificationTool):
subject
=
'Subject'
,
subject
=
'Subject'
,
message
=
'Message'
)
message
=
'Message'
)
self
.
tic
()
self
.
tic
()
last_message
=
self
.
portal
.
MailHost
.
_last_message
last_message
,
=
self
.
portal
.
MailHost
.
_message_list
self
.
assertNotEquals
((),
last_message
)
mfrom
,
mto
,
messageText
=
last_message
mfrom
,
mto
,
messageText
=
last_message
mail_dict
=
decode_email
(
messageText
)
mail_dict
=
decode_email
(
messageText
)
self
.
assertEquals
(
'Portal Administrator <site@example.invalid>'
,
mfrom
)
self
.
assertEquals
(
'Portal Administrator <site@example.invalid>'
,
mfrom
)
...
...
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