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
Carlos Ramos Carreño
erp5
Commits
880b97a7
Commit
880b97a7
authored
Feb 01, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testFormPrintoutAsODG: py3
parent
2c9db55b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
product/ERP5OOo/tests/testFormPrintoutAsODG.py
product/ERP5OOo/tests/testFormPrintoutAsODG.py
+10
-11
No files found.
product/ERP5OOo/tests/testFormPrintoutAsODG.py
View file @
880b97a7
...
@@ -152,7 +152,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
...
@@ -152,7 +152,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
# check the style is keept after the odg generation
# check the style is keept after the odg generation
self
.
assertEqual
(
final_document_style_dict
,
style_dict
)
self
.
assertEqual
(
final_document_style_dict
,
style_dict
)
self
.
assert
True
(
content_xml
.
find
(
"Foo title!"
)
>
0
)
self
.
assert
In
(
b"Foo title!"
,
content_xml
)
self
.
assertEqual
(
request
.
RESPONSE
.
getHeader
(
'content-type'
),
self
.
assertEqual
(
request
.
RESPONSE
.
getHeader
(
'content-type'
),
'application/vnd.oasis.opendocument.graphics'
)
'application/vnd.oasis.opendocument.graphics'
)
self
.
assertEqual
(
request
.
RESPONSE
.
getHeader
(
'content-disposition'
),
self
.
assertEqual
(
request
.
RESPONSE
.
getHeader
(
'content-disposition'
),
...
@@ -161,12 +161,11 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
...
@@ -161,12 +161,11 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
# 2. Normal case: change the field value and check again the ODF document
# 2. Normal case: change the field value and check again the ODF document
test1
.
setTitle
(
"Changed Title!"
)
test1
.
setTitle
(
"Changed Title!"
)
#foo_form.my_title.set_value('default', "Changed Title!")
odf_document
=
foo_printout
.
index_html
(
request
)
odf_document
=
foo_printout
.
index_html
(
request
)
self
.
assertTrue
(
odf_document
is
not
None
)
self
.
assertTrue
(
odf_document
is
not
None
)
builder
=
OOoBuilder
(
odf_document
)
builder
=
OOoBuilder
(
odf_document
)
content_xml
=
builder
.
extract
(
"content.xml"
)
content_xml
=
builder
.
extract
(
"content.xml"
)
self
.
assert
True
(
content_xml
.
find
(
"Changed Title!"
)
>
0
)
self
.
assert
In
(
b"Changed Title!"
,
content_xml
)
self
.
_validate
(
odf_document
)
self
.
_validate
(
odf_document
)
# 3. False case: change the field name
# 3. False case: change the field name
...
@@ -178,7 +177,8 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
...
@@ -178,7 +177,8 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
self
.
assertTrue
(
odf_document
is
not
None
)
self
.
assertTrue
(
odf_document
is
not
None
)
builder
=
OOoBuilder
(
odf_document
)
builder
=
OOoBuilder
(
odf_document
)
content_xml
=
builder
.
extract
(
"content.xml"
)
content_xml
=
builder
.
extract
(
"content.xml"
)
self
.
assertFalse
(
content_xml
.
find
(
"you cannot find"
)
>
0
)
self
.
assertNotIn
(
b"you cannot find!"
,
content_xml
)
self
.
_validate
(
odf_document
)
self
.
_validate
(
odf_document
)
# put back
# put back
foo_form
.
manage_renameObject
(
'xxx_title'
,
'my_title'
,
REQUEST
=
request
)
foo_form
.
manage_renameObject
(
'xxx_title'
,
'my_title'
,
REQUEST
=
request
)
...
@@ -199,7 +199,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
...
@@ -199,7 +199,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
self
.
assertTrue
(
odf_document
is
not
None
)
self
.
assertTrue
(
odf_document
is
not
None
)
builder
=
OOoBuilder
(
odf_document
)
builder
=
OOoBuilder
(
odf_document
)
content_xml
=
builder
.
extract
(
"content.xml"
)
content_xml
=
builder
.
extract
(
"content.xml"
)
self
.
assert
True
(
content_xml
.
find
(
"call!"
)
>
0
)
self
.
assert
In
(
b"call!"
,
content_xml
)
# when just call FormPrintout, it does not change content-type
# when just call FormPrintout, it does not change content-type
# Zope4 add charset=utf-8
# Zope4 add charset=utf-8
self
.
assertTrue
(
'text/html'
in
request
.
RESPONSE
.
getHeader
(
'content-type'
))
self
.
assertTrue
(
'text/html'
in
request
.
RESPONSE
.
getHeader
(
'content-type'
))
...
@@ -211,7 +211,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
...
@@ -211,7 +211,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
self
.
assertTrue
(
odf_document
is
not
None
)
self
.
assertTrue
(
odf_document
is
not
None
)
builder
=
OOoBuilder
(
odf_document
)
builder
=
OOoBuilder
(
odf_document
)
content_xml
=
builder
.
extract
(
"content.xml"
)
content_xml
=
builder
.
extract
(
"content.xml"
)
self
.
assert
True
(
content_xml
.
find
(
"Français"
)
>
0
)
self
.
assert
In
(
u"Français"
.
encode
(
'utf-8'
),
content_xml
)
self
.
_validate
(
odf_document
)
self
.
_validate
(
odf_document
)
# 6. Normal case: unicode string
# 6. Normal case: unicode string
...
@@ -220,7 +220,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
...
@@ -220,7 +220,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
self
.
assertTrue
(
odf_document
is
not
None
)
self
.
assertTrue
(
odf_document
is
not
None
)
builder
=
OOoBuilder
(
odf_document
)
builder
=
OOoBuilder
(
odf_document
)
content_xml
=
builder
.
extract
(
"content.xml"
)
content_xml
=
builder
.
extract
(
"content.xml"
)
self
.
assert
True
(
content_xml
.
find
(
"Français test2"
)
>
0
)
self
.
assert
In
(
u"Français test2"
.
encode
(
'utf-8'
),
content_xml
)
# leave _validate() here not to forget the validation failure
# leave _validate() here not to forget the validation failure
self
.
_validate
(
odf_document
)
self
.
_validate
(
odf_document
)
...
@@ -278,8 +278,8 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
...
@@ -278,8 +278,8 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
self
.
assertEqual
(
final_document_style_dict
,
style_dict
)
self
.
assertEqual
(
final_document_style_dict
,
style_dict
)
# check the two lines are prensent in the generated document
# check the two lines are prensent in the generated document
self
.
assert
True
(
content_xml
.
find
(
'A text a bit more longer'
)
>
0
)
self
.
assert
In
(
b'A text a bit more longer'
,
content_xml
)
self
.
assert
True
(
content_xml
.
find
(
'With a newline !'
)
>
0
)
self
.
assert
In
(
b'With a newline !'
,
content_xml
)
# check there is two line-break in the element my_description
# check there is two line-break in the element my_description
text_xpath
=
'//draw:frame[@draw:name="my_description"]//text:line-break'
text_xpath
=
'//draw:frame[@draw:name="my_description"]//text:line-break'
...
@@ -412,12 +412,11 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
...
@@ -412,12 +412,11 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
# 2. Normal case: change the field value and check again the ODF document
# 2. Normal case: change the field value and check again the ODF document
test1
.
setTitle
(
"Changed Title!"
)
test1
.
setTitle
(
"Changed Title!"
)
#foo_form.my_title.set_value('default', "Changed Title!")
odf_document
=
foo_printout
.
index_html
(
request
)
odf_document
=
foo_printout
.
index_html
(
request
)
self
.
assertTrue
(
odf_document
is
not
None
)
self
.
assertTrue
(
odf_document
is
not
None
)
builder
=
OOoBuilder
(
odf_document
)
builder
=
OOoBuilder
(
odf_document
)
content_xml
=
builder
.
extract
(
"content.xml"
)
content_xml
=
builder
.
extract
(
"content.xml"
)
self
.
assertIn
(
b"Changed
t
itle!"
,
content_xml
)
self
.
assertIn
(
b"Changed
T
itle!"
,
content_xml
)
self
.
_validate
(
odf_document
)
self
.
_validate
(
odf_document
)
# 3. False case: change the field name
# 3. False case: change the field name
...
...
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