Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Kirill Smelkov
Zope
Commits
19eead51
Commit
19eead51
authored
Dec 17, 2006
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PUT factory tests
parent
d2961fc0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
3 deletions
+30
-3
lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
...thon/Products/PageTemplates/tests/testZopePageTemplate.py
+30
-3
No files found.
lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
View file @
19eead51
...
...
@@ -22,8 +22,7 @@ ascii_str = '<html><body>hello world</body></html>'
iso885915_str
=
'<html><body></body></html>'
utf8_str
=
unicode
(
iso885915_str
,
'iso-8859-15'
).
encode
(
'utf-8'
)
xml_template
=
'''
<?xml vesion="1.0" encoding="%s"?>
xml_template
=
'''<?xml vesion="1.0" encoding="%s"?>
<foo>
</foo>
...
...
@@ -81,12 +80,40 @@ class ZopePageTemplateFileTests(ZopeTestCase):
self
.
assertEqual
(
result
.
startswith
(
iso885915_str
),
True
)
def
testPT_RenderWithUTF8
(
self
):
manage_addPageTemplate
(
self
.
app
,
'test'
,
text
=
utf8_str
,
encoding
=
'utf8'
)
manage_addPageTemplate
(
self
.
app
,
'test'
,
text
=
utf8_str
,
encoding
=
'utf
-
8'
)
zpt
=
self
.
app
[
'test'
]
result
=
zpt
.
pt_render
()
# use startswith() because the renderer appends a trailing \n
self
.
assertEqual
(
result
.
startswith
(
utf8_str
),
True
)
def
_createZPT
(
self
):
manage_addPageTemplate
(
self
.
app
,
'test'
,
text
=
utf8_str
,
encoding
=
'utf-8'
)
zpt
=
self
.
app
[
'test'
]
return
zpt
def
_makePUTRequest
(
self
,
body
):
return
{
'BODY'
:
body
}
def
_put
(
self
,
text
):
zpt
=
self
.
_createZPT
()
REQUEST
=
self
.
app
.
REQUEST
REQUEST
.
set
(
'BODY'
,
text
)
zpt
.
PUT
(
REQUEST
,
REQUEST
.
RESPONSE
)
return
zpt
.
output_encoding
def
testPutHTMLIso8859_15WithCharsetInfo
(
self
):
self
.
assertEqual
(
self
.
_put
(
html_iso_8859_15_w_header
),
'iso-8859-15'
)
def
testPutHTMLUTF8_WithCharsetInfo
(
self
):
self
.
assertEqual
(
self
.
_put
(
html_utf8_w_header
),
'utf-8'
)
def
testPutXMLIso8859_15
(
self
):
""" XML: use always UTF-8 als output encoding """
self
.
assertEqual
(
self
.
_put
(
xml_iso_8859_15
),
'utf-8'
)
def
testPutXMLUTF8
(
self
):
""" XML: use always UTF-8 als output encoding """
self
.
assertEqual
(
self
.
_put
(
xml_utf8
),
'utf-8'
)
class
ZPTRegressions
(
unittest
.
TestCase
):
...
...
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