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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
erp5
Commits
8b7f9520
Commit
8b7f9520
authored
Mar 19, 2018
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_interface_post: first commit of test_exportAllExportableLetterPostInAPDFDocument
parent
cf3c14b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
10 deletions
+61
-10
bt5/erp5_interface_post/TestTemplateItem/portal_components/test.erp5.testInterfacePost.py
...lateItem/portal_components/test.erp5.testInterfacePost.py
+61
-10
No files found.
bt5/erp5_interface_post/TestTemplateItem/portal_components/test.erp5.testInterfacePost.py
View file @
8b7f9520
...
@@ -27,13 +27,13 @@
...
@@ -27,13 +27,13 @@
import
email
import
email
import
time
import
time
from
Products.ERP5Type.tests.ERP5TypeLiveTestCase
import
ERP5Type
Live
TestCase
from
Products.ERP5Type.tests.ERP5TypeLiveTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
,
removeZODBPythonScript
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
,
removeZODBPythonScript
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
from
DateTime
import
DateTime
from
DateTime
import
DateTime
class
TestInterfacePost
(
ERP5Type
Live
TestCase
):
class
TestInterfacePost
(
ERP5TypeTestCase
):
"""
"""
Tests the creation of "Post" documents when their related event type
Tests the creation of "Post" documents when their related event type
is sent.
is sent.
...
@@ -51,12 +51,11 @@ class TestInterfacePost(ERP5TypeLiveTestCase):
...
@@ -51,12 +51,11 @@ class TestInterfacePost(ERP5TypeLiveTestCase):
"""
"""
self
.
portal
.
MailHost
.
reset
()
self
.
portal
.
MailHost
.
reset
()
createZODBPythonScript
(
self
.
user
=
self
.
createSimpleUser
(
'user'
,
'user'
,
'admin'
)
self
.
portal
.
portal_skins
.
custom
,
if
self
.
user
is
not
None
and
'default_email'
not
in
self
.
user
:
"LetterPost_export"
,
self
.
user
.
edit
(
""
,
default_email_coordinate_text
=
'user@nexedi.com'
"if context.getSimulationState() == 'exportable':
\
n
context.export()"
,
)
)
# Make sure to have a difference of at least 1 second between test_launch_date
# Make sure to have a difference of at least 1 second between test_launch_date
# and creation_date of new documents, otherwise they won't be found by catalog
# and creation_date of new documents, otherwise they won't be found by catalog
...
@@ -100,9 +99,17 @@ class TestInterfacePost(ERP5TypeLiveTestCase):
...
@@ -100,9 +99,17 @@ class TestInterfacePost(ERP5TypeLiveTestCase):
else
:
else
:
return
result_list
return
result_list
def
stepCreateMailMessage
(
self
,
sequence
=
None
,
sequence_list
=
None
):
def
stepAllowAutoExportOfLetters
(
self
,
sequence
=
None
,
sequence_list
=
None
):
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
"LetterPost_export"
,
""
,
"if context.getSimulationState() == 'exportable':
\
n
context.export()"
,
)
def
_stepCreateEvent
(
self
,
portal_type
,
sequence
=
None
,
sequence_list
=
None
):
mail_message
=
self
.
portal
.
event_module
.
newContent
(
mail_message
=
self
.
portal
.
event_module
.
newContent
(
portal_type
=
'Mail Message'
,
portal_type
=
portal_type
,
source_value
=
self
.
sender
,
source_value
=
self
.
sender
,
destination_value_list
=
self
.
recipient_list
,
destination_value_list
=
self
.
recipient_list
,
title
=
'Promotional campaign'
,
title
=
'Promotional campaign'
,
...
@@ -111,6 +118,16 @@ class TestInterfacePost(ERP5TypeLiveTestCase):
...
@@ -111,6 +118,16 @@ class TestInterfacePost(ERP5TypeLiveTestCase):
sequence
[
'mail_message'
]
=
mail_message
sequence
[
'mail_message'
]
=
mail_message
sequence
.
setdefault
(
'mail_message_list'
,
[]).
append
(
mail_message
)
sequence
.
setdefault
(
'mail_message_list'
,
[]).
append
(
mail_message
)
def
stepCreateMailMessage
(
self
,
sequence
=
None
,
sequence_list
=
None
):
self
.
_stepCreateEvent
(
portal_type
=
'Mail Message'
,
sequence
=
sequence
,
sequence_list
=
sequence_list
)
def
stepCreateLetter
(
self
,
sequence
=
None
,
sequence_list
=
None
):
self
.
_stepCreateEvent
(
portal_type
=
'Letter'
,
sequence
=
sequence
,
sequence_list
=
sequence_list
)
def
stepCreateInternetMessagePost
(
self
,
sequence
=
None
,
sequence_list
=
None
):
def
stepCreateInternetMessagePost
(
self
,
sequence
=
None
,
sequence_list
=
None
):
internet_message_post
=
self
.
portal
.
internet_message_post_module
.
newContent
(
internet_message_post
=
self
.
portal
.
internet_message_post_module
.
newContent
(
portal_type
=
'Internet Message Post'
,
portal_type
=
'Internet Message Post'
,
...
@@ -287,6 +304,12 @@ class TestInterfacePost(ERP5TypeLiveTestCase):
...
@@ -287,6 +304,12 @@ class TestInterfacePost(ERP5TypeLiveTestCase):
self
.
assertEqual
(
response
.
getDestinationTitle
(),
'sender'
)
self
.
assertEqual
(
response
.
getDestinationTitle
(),
'sender'
)
self
.
assertEqual
(
response
.
getSimulationState
(),
'delivered'
)
self
.
assertEqual
(
response
.
getSimulationState
(),
'delivered'
)
def
stepLaunchExportOnLetterPostModule
(
self
,
sequence
=
None
,
sequence_list
=
None
):
self
.
assertIn
(
"Report%20Started"
,
self
.
portal
.
letter_post_module
.
LetterPostModule_exportExportableLetterPost
()
)
def
test_emailSendingIsPilotedByInternetMessagePost
(
self
):
def
test_emailSendingIsPilotedByInternetMessagePost
(
self
):
"""
"""
"""
"""
...
@@ -361,3 +384,31 @@ class TestInterfacePost(ERP5TypeLiveTestCase):
...
@@ -361,3 +384,31 @@ class TestInterfacePost(ERP5TypeLiveTestCase):
"""
"""
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
sequence_list
.
play
(
self
)
def
stepLoginAsUser
(
self
,
sequence
=
None
):
self
.
loginByUserName
(
'user'
)
def
stepLogin
(
self
,
sequence
=
None
):
self
.
loginByUserName
()
def
stepCheckAggregatingPDFDocument
(
self
,
sequence
=
None
,
sequence_list
=
None
):
pdf_document_list
=
self
.
_portal_catalog
(
portal_type
=
'PDF'
)
self
.
assertEqual
(
len
(
pdf_document_list
),
1
)
def
test_exportAllExportableLetterPostInAPDFDocument
(
self
):
"""
Test the action on Letter Post Module to export all exportable Letter Posts
and aggregate their content in a unique PDF document (easy to print)
"""
sequence_list
=
SequenceList
()
sequence_string
=
"""
stepCreateLetter
stepCreateLetter
stepLoginAsUser
stepLaunchExportOnLetterPostModule
stepLogin
stepTic
stepCheckOnlyOneMessageHasBeenSentFromMailHost
"""
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
\ No newline at end of file
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