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
Georgios Dagkakis
erp5
Commits
fbc2d816
Commit
fbc2d816
authored
Nov 14, 2018
by
Aurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test notification message used when report stored as document
parent
cf490497
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
0 deletions
+59
-0
product/ERP5OOo/tests/testDeferredStyle.py
product/ERP5OOo/tests/testDeferredStyle.py
+59
-0
No files found.
product/ERP5OOo/tests/testDeferredStyle.py
View file @
fbc2d816
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
import
unittest
import
unittest
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Testing
import
ZopeTestCase
from
Testing
import
ZopeTestCase
from
AccessControl.SecurityManagement
import
newSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
from
Products.ERP5OOo.tests.utils
import
Validator
from
Products.ERP5OOo.tests.utils
import
Validator
...
@@ -183,6 +184,64 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -183,6 +184,64 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
else
:
else
:
self
.
fail
(
'Attachment not found in email
\
n
%s'
%
message_text
)
self
.
fail
(
'Attachment not found in email
\
n
%s'
%
message_text
)
def
test_report_stored_as_document_with_notification_message
(
self
):
publication_section
=
"reporting"
classification
=
"collaborative"
createZODBPythonScript
(
self
.
portal
,
'NotificationMessage_getSubstitutionMappingDictFromArgument'
,
'mapping_dict'
,
'''return mapping_dict'''
)
notification_message
=
self
.
portal
.
notification_message_module
.
newContent
(
reference
=
"notification-deferred.report"
,
content_type
=
"text/html"
,
text_content
=
'Hi,
\
n
\
n
Here is the link(s) to your report(s) : ${report_link_list}.
\
n
\
n
'
,
text_content_substitution_mapping_method_id
=
'NotificationMessage_getSubstitutionMappingDictFromArgument'
,
)
notification_message
.
newContent
(
portal_type
=
"Role Definition"
,
role_name
=
"Auditor"
,
agent
=
"person_module/pers"
)
notification_message
.
validate
()
self
.
tic
()
system_preference
=
self
.
portal
.
portal_preferences
.
_getOb
(
'syspref'
,
None
)
system_preference
.
edit
(
preferred_deferred_report_stored_as_document
=
True
,
preferred_deferred_report_classification
=
classification
,
preferred_deferred_report_publication_section
=
publication_section
,
preferred_deferred_report_notification_message_reference
=
"notification-deferred.report"
)
self
.
loginAsUser
(
'bob'
)
self
.
portal
.
changeSkin
(
'Deferred'
)
response
=
self
.
publish
(
'/%s/person_module/pers/Base_viewHistory?deferred_portal_skin=%s'
%
(
self
.
portal
.
getId
(),
self
.
skin
),
'%s:%s'
%
(
self
.
username
,
self
.
password
))
self
.
tic
()
# A document has been created
document_list
=
self
.
portal
.
document_module
.
objectValues
()
self
.
assertEquals
(
len
(
document_list
),
1
)
document
=
document_list
[
0
].
getObject
()
expected_file_name
=
'History%s'
%
self
.
attachment_file_extension
self
.
assertEqual
(
expected_file_name
,
document
.
getFilename
())
self
.
assertEqual
(
'History'
,
document
.
getTitle
())
self
.
assertEqual
(
None
,
document
.
getReference
())
self
.
assertEqual
(
"shared"
,
document
.
getValidationState
())
self
.
assertEqual
(
publication_section
,
document
.
getPublicationSection
())
self
.
assertEqual
(
classification
,
document
.
getClassification
())
self
.
assertEqual
(
self
.
portal_type
,
document
.
getPortalType
())
last_message
=
self
.
portal
.
MailHost
.
_last_message
self
.
assertNotEquals
((),
last_message
)
mfrom
,
mto
,
message_text
=
last_message
self
.
assertEqual
(
'"%s" <%s>'
%
(
self
.
first_name
,
self
.
recipient_email_address
),
mto
[
0
])
mail_message
=
email
.
message_from_string
(
message_text
)
for
part
in
mail_message
.
walk
():
content_type
=
part
.
get_content_type
()
if
content_type
==
"text/html"
:
# "History" is the title of Base_viewHistory form
content
=
part
.
get_payload
()
self
.
assertTrue
(
"History%s"
%
self
.
attachment_file_extension
in
content
)
self
.
assertTrue
(
"erp5/document_module"
in
content
)
break
else
:
self
.
fail
(
'Attachment not found in email
\
n
%s'
%
message_text
)
def
test_pdf_report_stored_as_document
(
self
):
def
test_pdf_report_stored_as_document
(
self
):
publication_section
=
"reporting"
publication_section
=
"reporting"
classification
=
"collaborative"
classification
=
"collaborative"
...
...
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