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
Tomáš Peterka
erp5
Commits
a24b251b
Commit
a24b251b
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
ce9e92bf
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 @
a24b251b
...
@@ -39,6 +39,7 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -39,6 +39,7 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
skin
=
content_type
=
None
skin
=
content_type
=
None
recipient_email_address
=
'invalid@example.com'
recipient_email_address
=
'invalid@example.com'
attachment_file_extension
=
''
attachment_file_extension
=
''
format
=
''
username
=
'bob'
username
=
'bob'
password
=
'bobpwd'
password
=
'bobpwd'
# the weird '<' char is to force quoting of the first name on the e-mail
# the weird '<' char is to force quoting of the first name on the e-mail
...
@@ -83,8 +84,8 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -83,8 +84,8 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
loginAsUser
(
'bob'
)
self
.
loginAsUser
(
'bob'
)
self
.
portal
.
changeSkin
(
'Deferred'
)
self
.
portal
.
changeSkin
(
'Deferred'
)
response
=
self
.
publish
(
response
=
self
.
publish
(
'/%s/person_module/pers/Base_viewHistory?deferred_portal_skin=%s'
'/%s/person_module/pers/Base_viewHistory?deferred_portal_skin=%s
&format=%s
'
%
(
self
.
portal
.
getId
(),
self
.
skin
),
'%s:%s'
%
(
self
.
username
,
self
.
password
))
%
(
self
.
portal
.
getId
(),
self
.
skin
,
self
.
format
),
'%s:%s'
%
(
self
.
username
,
self
.
password
))
self
.
tic
()
self
.
tic
()
last_message
=
self
.
portal
.
MailHost
.
_last_message
last_message
=
self
.
portal
.
MailHost
.
_last_message
self
.
assertNotEquals
((),
last_message
)
self
.
assertNotEquals
((),
last_message
)
...
@@ -102,9 +103,12 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -102,9 +103,12 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
assertEquals
(
'attachment; filename="%s"'
%
expected_file_name
,
self
.
assertEquals
(
'attachment; filename="%s"'
%
expected_file_name
,
part
.
get
(
'Content-Disposition'
))
part
.
get
(
'Content-Disposition'
))
data
=
part
.
get_payload
(
decode
=
True
)
data
=
part
.
get_payload
(
decode
=
True
)
error_list
=
Validator
().
validate
(
data
)
if
self
.
format
==
''
:
if
error_list
:
error_list
=
Validator
().
validate
(
data
)
self
.
fail
(
''
.
join
(
error_list
))
if
error_list
:
self
.
fail
(
''
.
join
(
error_list
))
elif
self
.
format
==
'pdf'
:
self
.
assertTrue
(
data
.
startswith
(
'%PDF'
))
break
break
else
:
else
:
self
.
fail
(
'Attachment not found in email
\
n
%s'
%
message_text
)
self
.
fail
(
'Attachment not found in email
\
n
%s'
%
message_text
)
...
@@ -116,8 +120,9 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -116,8 +120,9 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
response
=
self
.
publish
(
response
=
self
.
publish
(
'/%s/person_module/pers/Base_callDialogMethod?deferred_portal_skin=%s&'
'/%s/person_module/pers/Base_callDialogMethod?deferred_portal_skin=%s&'
'dialog_method=Person_view&dialog_id=Person_view&'
'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
.
skin
,
self
.
format
,
'X'
*
2000
),
'X'
*
2000
),
'%s:%s'
%
(
self
.
username
,
self
.
password
))
'%s:%s'
%
(
self
.
username
,
self
.
password
))
self
.
tic
()
self
.
tic
()
...
@@ -136,9 +141,12 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -136,9 +141,12 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
assertEquals
(
'attachment; filename="%s"'
%
expected_file_name
,
self
.
assertEquals
(
'attachment; filename="%s"'
%
expected_file_name
,
part
.
get
(
'Content-Disposition'
))
part
.
get
(
'Content-Disposition'
))
data
=
part
.
get_payload
(
decode
=
True
)
data
=
part
.
get_payload
(
decode
=
True
)
error_list
=
Validator
().
validate
(
data
)
if
self
.
format
==
''
:
if
error_list
:
error_list
=
Validator
().
validate
(
data
)
self
.
fail
(
''
.
join
(
error_list
))
if
error_list
:
self
.
fail
(
''
.
join
(
error_list
))
elif
self
.
format
==
'pdf'
:
self
.
assertTrue
(
data
.
startswith
(
'%PDF'
))
break
break
else
:
else
:
self
.
fail
(
'Attachment not found in email
\
n
%s'
%
message_text
)
self
.
fail
(
'Attachment not found in email
\
n
%s'
%
message_text
)
...
@@ -149,16 +157,42 @@ class TestODSDeferredStyle(TestDeferredStyle):
...
@@ -149,16 +157,42 @@ class TestODSDeferredStyle(TestDeferredStyle):
content_type
=
'application/vnd.oasis.opendocument.spreadsheet'
content_type
=
'application/vnd.oasis.opendocument.spreadsheet'
attachment_file_extension
=
'.ods'
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
):
class
TestODTDeferredStyle
(
TestDeferredStyle
):
skin
=
'ODT'
skin
=
'ODT'
content_type
=
'application/vnd.oasis.opendocument.text'
content_type
=
'application/vnd.oasis.opendocument.text'
attachment_file_extension
=
'.odt'
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
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestODSDeferredStyle
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestODSDeferredStyle
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestODSDeferredStyleFormatXLSX
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestODSDeferredStyleFormatPDF
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestODTDeferredStyle
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestODTDeferredStyle
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestODTDeferredStyleFormatDOCX
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestODTDeferredStyleFormatPDF
))
return
suite
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