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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Leo Le Bouter
erp5
Commits
3ae828d6
Commit
3ae828d6
authored
Jun 02, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testBusinessTemplateTwoFileExport: cosmetics
parent
48a149de
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
122 deletions
+91
-122
product/ERP5/tests/testBusinessTemplateTwoFileExport.py
product/ERP5/tests/testBusinessTemplateTwoFileExport.py
+91
-122
No files found.
product/ERP5/tests/testBusinessTemplateTwoFileExport.py
View file @
3ae828d6
...
@@ -275,10 +275,12 @@ class TestBusinessTemplateTwoFileExport(ERP5TypeTestCase):
...
@@ -275,10 +275,12 @@ class TestBusinessTemplateTwoFileExport(ERP5TypeTestCase):
image_data
=
"""iVBORw0KGgoAAAANSUhEUgAAAAUA
image_data
=
"""iVBORw0KGgoAAAANSUhEUgAAAAUA
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
9TXL0Y4OHwAAAABJRU5ErkJggg=="""
9TXL0Y4OHwAAAABJRU5ErkJggg=="""
image_document_kw
=
{
"title"
:
"foo"
,
"data"
:
image_data
,
"portal_type"
:
"Image"
}
self
.
_checkTwoFileImportExportForImageInImageModule
(
image_document_kw
,
'.png'
)
self
.
_checkTwoFileImportExportForImageInImageModule
(
dict
(
title
=
"foo"
,
data
=
image_data
,
portal_type
=
"Image"
,
),
'.png'
)
def
test_twoFileImportExportForImageIdentifyingTypeByContentType
(
self
):
def
test_twoFileImportExportForImageIdentifyingTypeByContentType
(
self
):
...
@@ -289,11 +291,13 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -289,11 +291,13 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
image_data
=
"""MalformedBase64HereiVBORw0KGgoAAAANSUhEUgAAAAUA
image_data
=
"""MalformedBase64HereiVBORw0KGgoAAAANSUhEUgAAAAUA
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
9TXL0Y4OHwAAAABJRU5ErkJggg=="""
9TXL0Y4OHwAAAABJRU5ErkJggg=="""
image_document_kw
=
{
"title"
:
"foo"
,
"data"
:
image_data
,
"portal_type"
:
"Image"
,
"content_type"
:
"image/jpeg"
}
self
.
_checkTwoFileImportExportForImageInImageModule
(
image_document_kw
,
self
.
_checkTwoFileImportExportForImageInImageModule
(
dict
(
'.pjpg'
)
title
=
"foo"
,
data
=
image_data
,
content_type
=
"image/jpeg"
,
portal_type
=
"Image"
,
),
'.pjpg'
)
def
test_twoFileImportExportForImageNotIdentifyingType
(
self
):
def
test_twoFileImportExportForImageNotIdentifyingType
(
self
):
"""
"""
...
@@ -303,11 +307,12 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -303,11 +307,12 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
image_data
=
"""MalformedBase64HereiVBORw0KGgoAAAANSUhEUgAAAAUA
image_data
=
"""MalformedBase64HereiVBORw0KGgoAAAANSUhEUgAAAAUA
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
9TXL0Y4OHwAAAABJRU5ErkJggg=="""
9TXL0Y4OHwAAAABJRU5ErkJggg=="""
image_document_kw
=
{
"title"
:
"foo"
,
"data"
:
image_data
,
"portal_type"
:
"Image"
}
self
.
_checkTwoFileImportExportForImageInImageModule
(
image_document_kw
,
self
.
_checkTwoFileImportExportForImageInImageModule
(
dict
(
'.bin'
)
title
=
"foo"
,
data
=
image_data
,
portal_type
=
"Image"
,
),
'.bin'
)
def
_checkTwoFileImportExportForDocumentInDocumentModule
(
self
,
def
_checkTwoFileImportExportForDocumentInDocumentModule
(
self
,
file_document_kw
,
file_document_kw
,
...
@@ -341,88 +346,71 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -341,88 +346,71 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
Test Business Template Import And Export With File
Test Business Template Import And Export With File
where extension (.js) is identified by the content_type
where extension (.js) is identified by the content_type
"""
"""
file_content
=
"a test file"
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
dict
(
file_content_type
=
"text/javascript"
title
=
"foo"
,
file_title
=
"foo"
data
=
"a test file"
,
content_type
=
"text/javascript"
,
file_document_kw
=
{
"title"
:
file_title
,
"data"
:
file_content
,
portal_type
=
"File"
,
"content_type"
:
file_content_type
,
),
'.js'
)
"portal_type"
:
"File"
}
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
file_document_kw
,
'.js'
)
def
test_twoFileImportExportForFileIdentifyingTypeByContentTypeObj
(
self
):
def
test_twoFileImportExportForFileIdentifyingTypeByContentTypeObj
(
self
):
"""
"""
Test Business Template Import And Export With File
Test Business Template Import And Export With File
where extension (.obj) is identified by the content_type
where extension (.obj) is identified by the content_type
"""
"""
file_content
=
"a test file"
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
dict
(
file_content_type
=
"application/octet-stream"
title
=
"foo"
,
file_title
=
"foo"
data
=
"a test file"
,
file_document_kw
=
{
"title"
:
file_title
,
"data"
:
file_content
,
content_type
=
"application/octet-stream"
,
"content_type"
:
file_content_type
,
portal_type
=
"File"
,
"portal_type"
:
"File"
}
),
'.obj'
)
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
file_document_kw
,
'.obj'
)
def
test_twoFileImportExportForFileIdentifyingTypeByContentTypeEpub
(
self
):
def
test_twoFileImportExportForFileIdentifyingTypeByContentTypeEpub
(
self
):
"""
"""
Test Business Template Import And Export With File
Test Business Template Import And Export With File
where extension (.epub) is identified by the content_type
where extension (.epub) is identified by the content_type
"""
"""
file_content
=
"a test file"
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
dict
(
file_content_type
=
"application/epub+zip"
title
=
"foo"
,
file_title
=
"foo"
data
=
"a test file"
,
file_document_kw
=
{
"title"
:
file_title
,
"data"
:
file_content
,
content_type
=
"application/epub+zip"
,
"content_type"
:
file_content_type
,
portal_type
=
"File"
,
"portal_type"
:
"File"
}
),
'.epub'
)
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
file_document_kw
,
'.epub'
)
def
test_twoFileImportExportForFileIdentifyingTypeByTitleJS
(
self
):
def
test_twoFileImportExportForFileIdentifyingTypeByTitleJS
(
self
):
"""
"""
Test Business Template Import And Export With File
Test Business Template Import And Export With File
where extension (.js) is identified by the title
where extension (.js) is identified by the title
"""
"""
file_content
=
"a test file"
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
dict
(
file_title
=
"foo.js"
title
=
"foo.js"
,
file_document_kw
=
{
"title"
:
file_title
,
"data"
:
file_content
,
data
=
"a test file"
,
"portal_type"
:
"File"
}
portal_type
=
"File"
,
),
'.js'
)
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
file_document_kw
,
'.js'
)
def
test_twoFileImportExportForFileIdentifyingTypeByReferenceJS
(
self
):
def
test_twoFileImportExportForFileIdentifyingTypeByReferenceJS
(
self
):
"""
"""
Test Business Template Import And Export With File
Test Business Template Import And Export With File
where extension (.js) is identified by the reference
where extension (.js) is identified by the reference
"""
"""
file_content
=
"<script> ... </script>"
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
dict
(
file_title
=
"foo"
title
=
"foo"
,
file_document_kw
=
{
"title"
:
file_title
,
"data"
:
file_content
,
data
=
"<script> ... </script>"
,
"default_reference"
:
file_title
+
".js"
,
default_reference
=
"foo.js"
,
"portal_type"
:
"File"
}
portal_type
=
"File"
,
),
'.js'
)
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
file_document_kw
,
'.js'
)
def
test_twoFileImportExportForFileNotIdentifyingTypeEmptyContentType
(
self
):
def
test_twoFileImportExportForFileNotIdentifyingTypeEmptyContentType
(
self
):
"""
"""
Test Business Template Import And Export With File
Test Business Template Import And Export With File
where extension is not identified, so it is exported as .bin
where extension is not identified, so it is exported as .bin
"""
"""
file_content
=
"a test file"
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
dict
(
file_content_type
=
None
title
=
"foo"
,
file_title
=
"foo"
data
=
"a test file"
,
file_document_kw
=
{
"title"
:
file_title
,
"data"
:
file_content
,
content_type
=
None
,
"content_type"
:
file_content_type
,
portal_type
=
"File"
,
"portal_type"
:
"File"
}
),
'.bin'
)
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
file_document_kw
,
'.bin'
)
def
test_twoFileImportExportForFileNotIdentifyingTypeBinaryContentType
(
self
):
def
test_twoFileImportExportForFileNotIdentifyingTypeBinaryContentType
(
self
):
"""
"""
...
@@ -431,15 +419,12 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -431,15 +419,12 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
but it is identified as binary in the mimetypes_registry so it is
but it is identified as binary in the mimetypes_registry so it is
exported as .bin.
exported as .bin.
"""
"""
file_content
=
"a test file"
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
dict
(
file_content_type
=
'video/wavelet'
title
=
"foo"
,
file_title
=
"foo"
data
=
"a test file"
,
file_document_kw
=
{
"title"
:
file_title
,
"data"
:
file_content
,
content_type
=
"video/wavelet"
,
"content_type"
:
file_content_type
,
portal_type
=
"File"
,
"portal_type"
:
"File"
}
),
'.bin'
)
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
file_document_kw
,
'.bin'
)
def
test_twoFileImportExportForFileNotIdentifyingTypeNonBinaryContentType
(
self
):
def
test_twoFileImportExportForFileNotIdentifyingTypeNonBinaryContentType
(
self
):
"""
"""
...
@@ -448,15 +433,12 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -448,15 +433,12 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
but it is identified as non-binary in the mimetypes_registry so it is
but it is identified as non-binary in the mimetypes_registry so it is
exported as .txt.
exported as .txt.
"""
"""
file_content
=
"a test file"
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
dict
(
file_content_type
=
'text/x-uri'
title
=
"foo"
,
file_title
=
"foo"
data
=
"a test file"
,
file_document_kw
=
{
"title"
:
file_title
,
"data"
:
file_content
,
content_type
=
"text/x-uri"
,
"content_type"
:
file_content_type
,
portal_type
=
"File"
,
"portal_type"
:
"File"
}
),
'.txt'
)
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
file_document_kw
,
'.txt'
)
def
test_twoFileImportExportForFileIdentifyingTypeByTitleXML
(
self
):
def
test_twoFileImportExportForFileIdentifyingTypeByTitleXML
(
self
):
"""
"""
...
@@ -469,14 +451,12 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -469,14 +451,12 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
<surname>Doe</surname>
<surname>Doe</surname>
</person>
</person>
"""
"""
file_title
=
"foo.xml"
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
dict
(
file_content_type
=
None
title
=
"foo.xml"
,
file_document_kw
=
{
"title"
:
file_title
,
"data"
:
file_content
,
data
=
file_content
,
"content_type"
:
file_content_type
,
content_type
=
None
,
"portal_type"
:
"File"
}
portal_type
=
"File"
,
),
'._xml'
)
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
file_document_kw
,
'._xml'
)
def
test_twoFileImportExportForFileInPortalSkinsIdentifyingTypeByTitleXML
(
self
):
def
test_twoFileImportExportForFileInPortalSkinsIdentifyingTypeByTitleXML
(
self
):
"""
"""
...
@@ -534,13 +514,11 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -534,13 +514,11 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
def
test_twoFileImportExportForPDF
(
self
):
def
test_twoFileImportExportForPDF
(
self
):
"""Test Business Template Import And Export With A PDF Document"""
"""Test Business Template Import And Export With A PDF Document"""
pdf_data
=
"""pdf content, maybe should update for base64 sample"""
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
dict
(
title
=
"foo.pdf"
,
pdf_document_kw
=
{
"title"
:
"foo.pdf"
,
"data"
:
pdf_data
,
data
=
"pdf content, maybe should update for base64 sample"
,
"portal_type"
:
"PDF"
}
portal_type
=
"PDF"
,
),
'.pdf'
)
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
pdf_document_kw
,
'.pdf'
)
def
test_twoFileImportExportForCatalogMethodInCatalog
(
self
):
def
test_twoFileImportExportForCatalogMethodInCatalog
(
self
):
"""Test Business Template Import And Export With Catalog Method In Catalog"""
"""Test Business Template Import And Export With Catalog Method In Catalog"""
...
@@ -800,7 +778,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -800,7 +778,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
if
OOo_template_id
in
skin_folder
.
objectIds
():
if
OOo_template_id
in
skin_folder
.
objectIds
():
skin_folder
.
manage_delObjects
([
OOo_template_id
])
skin_folder
.
manage_delObjects
([
OOo_template_id
])
addOOoTemplate
=
skin_folder
.
manage_addProduct
[
'ERP5OOo'
].
addOOoTemplate
addOOoTemplate
=
skin_folder
.
manage_addProduct
[
'ERP5OOo'
].
addOOoTemplate
addOOoTemplate
(
id
=
OOo_template_id
,
title
=
OOo_template_data
)
addOOoTemplate
(
id
=
OOo_template_id
,
title
=
OOo_template_data
)
self
.
template
.
edit
(
template_skin_id_list
=
[
skin_folder_id
+
'/'
+
OOo_template_id
,])
self
.
template
.
edit
(
template_skin_id_list
=
[
skin_folder_id
+
'/'
+
OOo_template_id
,])
...
@@ -829,43 +807,34 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
@@ -829,43 +807,34 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
Test Business Template Import And Export With Spreadsheed where the
Test Business Template Import And Export With Spreadsheed where the
extension is not identified, so it is exported as '.bin'
extension is not identified, so it is exported as '.bin'
"""
"""
# XXX addding a dummy string in data leads to 'NotConvertedError'
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
dict
(
spreadsheet_data
=
''
title
=
"foo"
,
data
=
""
,
# XXX a dummy string in data leads to 'NotConvertedError'
spreadsheet_document_kw
=
{
"title"
:
"foo"
,
"data"
:
spreadsheet_data
,
portal_type
=
"Spreadsheet"
,
"portal_type"
:
"Spreadsheet"
}
),
'.bin'
)
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
spreadsheet_document_kw
,
'.bin'
)
def
test_twoFileImportExportForSpreadsheetIdentifyingTypeByContentType
(
self
):
def
test_twoFileImportExportForSpreadsheetIdentifyingTypeByContentType
(
self
):
"""
"""
Test Business Template Import And Export With Spreadsheed where the
Test Business Template Import And Export With Spreadsheed where the
extension is identified by content_type, so it is exported as '.ods'
extension is identified by content_type, so it is exported as '.ods'
"""
"""
# XXX addding a dummy string in data leads to 'NotConvertedError'
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
dict
(
spreadsheet_data
=
''
title
=
"foo"
,
data
=
""
,
# XXX a dummy string in data leads to 'NotConvertedError'
spreadsheet_document_kw
=
{
"title"
:
"foo"
,
"data"
:
spreadsheet_data
,
content_type
=
"application/vnd.oasis.opendocument.spreadsheet"
,
"portal_type"
:
"Spreadsheet"
,
portal_type
=
"Spreadsheet"
,
"content_type"
:
"application/vnd.oasis.opendocument.spreadsheet"
}
),
'.ods'
)
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
spreadsheet_document_kw
,
'.ods'
)
def
test_twoFileImportExportForSpreadsheetIdentifyingTypeByTitle
(
self
):
def
test_twoFileImportExportForSpreadsheetIdentifyingTypeByTitle
(
self
):
"""
"""
Test Business Template Import And Export With Spreadsheed where the
Test Business Template Import And Export With Spreadsheed where the
extension is identified by title, so it is exported as '.xlsx'
extension is identified by title, so it is exported as '.xlsx'
"""
"""
# XXX addding a dummy string in data leads to 'NotConvertedError'
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
dict
(
spreadsheet_data
=
''
title
=
"foo.xlsx"
,
data
=
""
,
# XXX a dummy string in data leads to 'NotConvertedError'
spreadsheet_document_kw
=
{
"title"
:
"foo.xlsx"
,
"data"
:
spreadsheet_data
,
portal_type
=
"Spreadsheet"
,
"portal_type"
:
"Spreadsheet"
}
),
'.xlsx'
)
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
spreadsheet_document_kw
,
'.xlsx'
)
def
test_twoFileImportExportForTestPage
(
self
):
def
test_twoFileImportExportForTestPage
(
self
):
"""Test Business Template Import And Export With A Test Page Document"""
"""Test Business Template Import And Export With A Test Page Document"""
...
...
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