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
a69b31d8
Commit
a69b31d8
authored
Dec 17, 2006
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some more tests for encoding issues
parent
a36cd872
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
1 deletion
+37
-1
lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
...thon/Products/PageTemplates/tests/testZopePageTemplate.py
+37
-1
No files found.
lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
View file @
a69b31d8
# -*- encoding: utf-8 -*.*
"""ZopePageTemplate regression tests.
Ensures that adding a page template works correctly.
...
...
@@ -6,13 +8,46 @@ Note: Tests require Zope >= 2.7
"""
import
unittest
import
Zope2
import
transaction
import
zope.component.testing
from
zope.traversing.adapters
import
DefaultTraversable
from
Testing.makerequest
import
makerequest
from
Testing.ZopeTestCase
import
ZopeTestCase
,
installProduct
from
Products.PageTemplates.ZopePageTemplate
import
ZopePageTemplate
,
manage_addPageTemplate
ascii_str
=
'<html><body>hello world</body></html>'
utf8_str
=
'<html><body>ÌöÀ</body></html>'
iso885915_str
=
unicode
(
utf8_str
,
'utf8'
).
encode
(
'iso-8859-15'
)
installProduct
(
'PageTemplates'
)
class
ZopePageTemplateFileTests
(
ZopeTestCase
):
def
testPT_RenderWithAscii
(
self
):
manage_addPageTemplate
(
self
.
app
,
'test'
,
text
=
ascii_str
,
encoding
=
'ascii'
)
zpt
=
self
.
app
[
'test'
]
result
=
zpt
.
pt_render
()
# use startswith() because the renderer appends a trailing \n
self
.
assertEqual
(
result
.
startswith
(
ascii_str
),
True
)
def
testPT_RenderWithISO885915
(
self
):
manage_addPageTemplate
(
self
.
app
,
'test'
,
text
=
iso885915_str
,
encoding
=
'iso-8859-15'
)
zpt
=
self
.
app
[
'test'
]
result
=
zpt
.
pt_render
()
# use startswith() because the renderer appends a trailing \n
self
.
assertEqual
(
result
.
startswith
(
iso885915_str
),
True
)
def
testPT_RenderWithUTF8
(
self
):
manage_addPageTemplate
(
self
.
app
,
'test'
,
text
=
utf8_str
,
encoding
=
'utf8'
)
zpt
=
self
.
app
[
'test'
]
result
=
zpt
.
pt_render
()
# use startswith() because the renderer appends a trailing \n
self
.
assertEqual
(
result
.
startswith
(
utf8_str
),
True
)
class
ZPTRegressions
(
unittest
.
TestCase
):
...
...
@@ -133,6 +168,7 @@ class DummyFileUpload:
def
test_suite
():
suite
=
unittest
.
makeSuite
(
ZPTRegressions
)
suite
.
addTests
(
unittest
.
makeSuite
(
ZPTMacros
))
suite
.
addTests
(
unittest
.
makeSuite
(
ZopePageTemplateFileTests
))
return
suite
if
__name__
==
'__main__'
:
...
...
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