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
preetwinder
erp5
Commits
09493ad0
Commit
09493ad0
authored
Apr 02, 2014
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorganise html to text tests and add test for html entities
parent
8b8d9439
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
7 deletions
+17
-7
product/ERP5/tests/testERP5Web.py
product/ERP5/tests/testERP5Web.py
+17
-7
No files found.
product/ERP5/tests/testERP5Web.py
View file @
09493ad0
...
...
@@ -179,17 +179,27 @@ class TestERP5Web(ERP5TypeTestCase):
self
.
assertEqual
(
'text/html'
,
page
.
getContentType
())
self
.
assertEqual
(
'<b>OK</b>'
,
page
.
getTextContent
())
def
test_02a_WebPageAsText
(
self
):
def
test_WebPageAsTextUTF8
(
self
):
"""Check if Web Page's asText() returns utf-8 string correctly
"""
Check if Web Page's asText() returns utf-8 string correctly and
if it is wrapped by certian column width.
"""
# disable portal_transforms cache
self
.
portal
.
portal_transforms
.
max_sec_in_cache
=
-
1
page
=
self
.
web_page_module
.
newContent
(
portal_type
=
'Web Page'
)
page
.
edit
(
text_content
=
'<p>Hé Hé Hé!</p>'
)
page
.
edit
(
text_content
=
'<p>Hé Hé Hé!</p>'
,
content_type
=
'text/html'
)
self
.
tic
()
self
.
assertEqual
(
'Hé Hé Hé!'
,
page
.
asText
().
strip
())
def
test_WebPageAsTextHTMLEntities
(
self
):
"""Check if Web Page's asText() converts html entities properly
"""
page
=
self
.
web_page_module
.
newContent
(
portal_type
=
'Web Page'
)
page
.
edit
(
text_content
=
'<p>Hé!</p>'
,
content_type
=
'text/html'
)
self
.
tic
()
self
.
assertEqual
(
'Hé!'
,
page
.
asText
().
strip
())
def
test_WebPageAsTextWrap
(
self
):
"""Check if Web Page's asText() is wrapped by certain column width.
"""
page
=
self
.
web_page_module
.
newContent
(
portal_type
=
'Web Page'
)
page
.
edit
(
text_content
=
'<p>Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé!</p>'
)
self
.
tic
()
self
.
assertEqual
(
"""Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé Hé
...
...
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