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
francois
erp5
Commits
cbfa8d56
Commit
cbfa8d56
authored
Jun 11, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test deferred style with converting to a format
parent
28824962
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
9 deletions
+43
-9
product/ERP5OOo/tests/testDeferredStyle.py
product/ERP5OOo/tests/testDeferredStyle.py
+43
-9
No files found.
product/ERP5OOo/tests/testDeferredStyle.py
View file @
cbfa8d56
...
...
@@ -39,6 +39,7 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
skin
=
content_type
=
None
recipient_email_address
=
'invalid@example.com'
attachment_file_extension
=
''
format
=
''
username
=
'bob'
password
=
'bobpwd'
# the weird '<' char is to force quoting of the first name on the e-mail
...
...
@@ -83,8 +84,8 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
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
))
'/%s/person_module/pers/Base_viewHistory?deferred_portal_skin=%s
&format=%s
'
%
(
self
.
portal
.
getId
(),
self
.
skin
,
self
.
format
),
'%s:%s'
%
(
self
.
username
,
self
.
password
))
self
.
tic
()
last_message
=
self
.
portal
.
MailHost
.
_last_message
self
.
assertNotEquals
((),
last_message
)
...
...
@@ -102,9 +103,12 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
assertEquals
(
'attachment; filename="%s"'
%
expected_file_name
,
part
.
get
(
'Content-Disposition'
))
data
=
part
.
get_payload
(
decode
=
True
)
error_list
=
Validator
().
validate
(
data
)
if
error_list
:
self
.
fail
(
''
.
join
(
error_list
))
if
self
.
format
==
''
:
error_list
=
Validator
().
validate
(
data
)
if
error_list
:
self
.
fail
(
''
.
join
(
error_list
))
elif
self
.
format
==
'pdf'
:
self
.
assertTrue
(
data
.
startswith
(
'%PDF'
))
break
else
:
self
.
fail
(
'Attachment not found in email
\
n
%s'
%
message_text
)
...
...
@@ -116,8 +120,9 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
response
=
self
.
publish
(
'/%s/person_module/pers/Base_callDialogMethod?deferred_portal_skin=%s&'
'dialog_method=Person_view&dialog_id=Person_view&'
'deferred_style:int=1&junk=%s'
%
(
self
.
portal
.
getId
(),
'deferred_style:int=1&
format=%s&
junk=%s'
%
(
self
.
portal
.
getId
(),
self
.
skin
,
self
.
format
,
'X'
*
2000
),
'%s:%s'
%
(
self
.
username
,
self
.
password
))
self
.
tic
()
...
...
@@ -136,9 +141,12 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
assertEquals
(
'attachment; filename="%s"'
%
expected_file_name
,
part
.
get
(
'Content-Disposition'
))
data
=
part
.
get_payload
(
decode
=
True
)
error_list
=
Validator
().
validate
(
data
)
if
error_list
:
self
.
fail
(
''
.
join
(
error_list
))
if
self
.
format
==
''
:
error_list
=
Validator
().
validate
(
data
)
if
error_list
:
self
.
fail
(
''
.
join
(
error_list
))
elif
self
.
format
==
'pdf'
:
self
.
assertTrue
(
data
.
startswith
(
'%PDF'
))
break
else
:
self
.
fail
(
'Attachment not found in email
\
n
%s'
%
message_text
)
...
...
@@ -149,16 +157,42 @@ class TestODSDeferredStyle(TestDeferredStyle):
content_type
=
'application/vnd.oasis.opendocument.spreadsheet'
attachment_file_extension
=
'.ods'
class
TestODSDeferredStyleFormatXLSX
(
TestDeferredStyle
):
skin
=
'ODS'
content_type
=
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
attachment_file_extension
=
'.xlsx'
format
=
'xlsx'
class
TestODSDeferredStyleFormatPDF
(
TestDeferredStyle
):
skin
=
'ODS'
content_type
=
'application/pdf'
attachment_file_extension
=
'.pdf'
format
=
'pdf'
class
TestODTDeferredStyle
(
TestDeferredStyle
):
skin
=
'ODT'
content_type
=
'application/vnd.oasis.opendocument.text'
attachment_file_extension
=
'.odt'
class
TestODTDeferredStyleFormatDOCX
(
TestDeferredStyle
):
skin
=
'ODT'
content_type
=
'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
attachment_file_extension
=
'.docx'
format
=
'docx'
class
TestODTDeferredStyleFormatPDF
(
TestDeferredStyle
):
skin
=
'ODT'
content_type
=
'application/pdf'
attachment_file_extension
=
'.pdf'
format
=
'pdf'
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestODSDeferredStyle
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestODSDeferredStyleFormatXLSX
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestODSDeferredStyleFormatPDF
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestODTDeferredStyle
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestODTDeferredStyleFormatDOCX
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestODTDeferredStyleFormatPDF
))
return
suite
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