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
46c0776f
Commit
46c0776f
authored
Mar 19, 2018
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! erp5_interface_post: first commit of test_exportAllExportableLetterPostInAPDFDocument
parent
8b7f9520
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
24 deletions
+53
-24
bt5/erp5_interface_post/TestTemplateItem/portal_components/test.erp5.testInterfacePost.py
...lateItem/portal_components/test.erp5.testInterfacePost.py
+53
-24
No files found.
bt5/erp5_interface_post/TestTemplateItem/portal_components/test.erp5.testInterfacePost.py
View file @
46c0776f
...
...
@@ -33,6 +33,7 @@ from Products.ERP5Type.tests.utils import createZODBPythonScript, removeZODBPyth
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
from
DateTime
import
DateTime
class
TestInterfacePost
(
ERP5TypeTestCase
):
"""
Tests the creation of "Post" documents when their related event type
...
...
@@ -51,8 +52,14 @@ class TestInterfacePost(ERP5TypeTestCase):
"""
self
.
portal
.
MailHost
.
reset
()
try
:
self
.
user
=
self
.
portal
.
person_module
[
'user'
]
except
KeyError
:
self
.
user
=
self
.
createSimpleUser
(
'user'
,
'user'
,
'admin'
)
if
self
.
user
is
not
None
and
'default_email'
not
in
self
.
user
:
self
.
user
.
setId
(
'user'
)
self
.
user
.
validate
()
if
'default_email'
not
in
self
.
user
:
self
.
user
.
edit
(
default_email_coordinate_text
=
'user@nexedi.com'
)
...
...
@@ -76,6 +83,7 @@ class TestInterfacePost(ERP5TypeTestCase):
self
.
recipient_list
=
[
self
.
recipient
,]
def
beforeTearDown
(
self
):
if
hasattr
(
self
.
portal
.
portal_skins
.
custom
,
"LetterPost_export"
):
removeZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
"LetterPost_export"
...
...
@@ -108,15 +116,16 @@ class TestInterfacePost(ERP5TypeTestCase):
)
def
_stepCreateEvent
(
self
,
portal_type
,
sequence
=
None
,
sequence_list
=
None
):
mail_message
=
self
.
portal
.
event_module
.
newContent
(
event
=
self
.
portal
.
event_module
.
newContent
(
portal_type
=
portal_type
,
source_value
=
self
.
sender
,
destination_value_list
=
self
.
recipient_list
,
title
=
'Promotional campaign'
,
text_content
=
self
.
default_mail_text_content
,
)
sequence
[
'mail_message'
]
=
mail_message
sequence
.
setdefault
(
'mail_message_list'
,
[]).
append
(
mail_message
)
sequence
[
'mail_message'
]
=
event
sequence
.
setdefault
(
'mail_message_list'
,
[]).
append
(
event
)
return
event
def
stepCreateMailMessage
(
self
,
sequence
=
None
,
sequence_list
=
None
):
self
.
_stepCreateEvent
(
portal_type
=
'Mail Message'
,
...
...
@@ -124,9 +133,14 @@ class TestInterfacePost(ERP5TypeTestCase):
sequence_list
=
sequence_list
)
def
stepCreateLetter
(
self
,
sequence
=
None
,
sequence_list
=
None
):
self
.
_stepCreateEvent
(
portal_type
=
'Letter'
,
letter
=
self
.
_stepCreateEvent
(
portal_type
=
'Letter'
,
sequence
=
sequence
,
sequence_list
=
sequence_list
)
sequence
.
setdefault
(
'letter_list'
,
[]).
append
(
letter
)
def
stepSendAllLetter
(
self
,
sequence
=
None
,
sequence_list
=
None
):
for
letter
in
sequence
[
'letter_list'
]:
letter
.
send
()
def
stepCreateInternetMessagePost
(
self
,
sequence
=
None
,
sequence_list
=
None
):
internet_message_post
=
self
.
portal
.
internet_message_post_module
.
newContent
(
...
...
@@ -197,6 +211,24 @@ class TestInterfacePost(ERP5TypeTestCase):
def
stepCheckOnlyOneLetterPostIsExported
(
self
,
sequence
=
None
,
sequence_list
=
None
):
self
.
_checkOnlyOnePostIsExportedByPortalType
(
'Letter Post'
)
def
stepCheckAllLetterPostAreExportable
(
self
,
sequence
=
None
,
sequence_list
=
None
):
letter_post_list
=
self
.
_portal_catalog
(
portal_type
=
'Letter Post'
,
simulation_state
=
'exportable'
,
)
self
.
assertEqual
(
len
(
letter_post_list
),
len
(
sequence
[
'letter_list'
]))
for
letter_post
in
letter_post_list
:
self
.
assertEqual
(
letter_post
.
getSimulationState
(),
'exportable'
)
def
stepCheckAllLetterPostAreExported
(
self
,
sequence
=
None
,
sequence_list
=
None
):
letter_post_list
=
self
.
_portal_catalog
(
portal_type
=
'Letter Post'
,
simulation_state
=
'exported'
,
)
self
.
assertEqual
(
len
(
letter_post_list
),
len
(
sequence
[
'letter_list'
]))
for
letter_post
in
letter_post_list
:
self
.
assertEqual
(
letter_post
.
getSimulationState
(),
'exported'
)
def
stepCheckInternetMessagePostCreated
(
self
,
sequence
=
None
,
sequence_list
=
None
):
mail_message
=
sequence
[
'mail_message'
]
internet_message_post_list
=
mail_message
.
getAggregateValueList
(
...
...
@@ -305,10 +337,7 @@ class TestInterfacePost(ERP5TypeTestCase):
self
.
assertEqual
(
response
.
getSimulationState
(),
'delivered'
)
def
stepLaunchExportOnLetterPostModule
(
self
,
sequence
=
None
,
sequence_list
=
None
):
self
.
assertIn
(
"Report%20Started"
,
self
.
portal
.
letter_post_module
.
LetterPostModule_exportExportableLetterPost
()
)
self
.
portal
.
letter_post_module
.
LetterPostModule_exportExportableLetterPostActivity
(
user_name
=
self
.
user
.
getUserId
())
def
test_emailSendingIsPilotedByInternetMessagePost
(
self
):
"""
...
...
@@ -385,15 +414,11 @@ class TestInterfacePost(ERP5TypeTestCase):
sequence_list
.
addSequenceString
(
sequence_string
)
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
)
pdf_document
,
=
pdf_document_list
self
.
assertEqual
(
2
,
int
(
pdf_document
.
getContentInformation
()[
'Pages'
]))
def
test_exportAllExportableLetterPostInAPDFDocument
(
self
):
"""
...
...
@@ -404,11 +429,15 @@ class TestInterfacePost(ERP5TypeTestCase):
sequence_string
=
"""
stepCreateLetter
stepCreateLetter
stepLoginAsUser
stepSendAllLetter
stepTic
stepCheckAllLetterPostAreExportable
stepLaunchExportOnLetterPostModule
stepLogin
stepTic
stepCheckAllLetterPostAreExported
stepTic
stepCheckOnlyOneMessageHasBeenSentFromMailHost
stepCheckAggregatingPDFDocument
"""
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