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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tristan Cavelier
erp5
Commits
e0d19724
Commit
e0d19724
authored
Dec 08, 2016
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup ! add test
parent
9ba87c92
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
product/ERP5/tests/testERP5Core.py
product/ERP5/tests/testERP5Core.py
+22
-0
No files found.
product/ERP5/tests/testERP5Core.py
View file @
e0d19724
...
...
@@ -650,6 +650,28 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
assertEqual
(
response
.
getStatus
(),
401
)
self
.
assertNotIn
(
"Also, the following error occurred"
,
str
(
response
))
def
test_raisingNotFoundDoesNotShowEscapedHtml
(
self
):
"""
NotFound error are sent with html as error reason. Zope added a fix to
avoid XSS that escape html before showing it. Here, we don't make sure
that the error reason is unescaped, but we make sure that NotFound errors
produces a good rendering (e.g. without `<p>`).
"""
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
portal
=
self
.
getPortal
()
base_script
=
createZODBPythonScript
(
portal
.
portal_skins
.
custom
,
'test_raisingNotFoundDoesNotShowEscapedHtml'
,
'scripts_params=None'
,
'from zExceptions import NotFound
\
n
raise NotFound, '
+
'"<p><strong>error test tristan</strong></p>"'
)
response
=
self
.
publish
(
"%s/test_raisingNotFoundDoesNotShowEscapedHtml"
%
self
.
portal_id
)
self
.
assertEqual
(
response
.
getStatus
(),
404
)
self
.
assertNotIn
(
"error test tristan"
,
str
(
response
))
self
.
assertNotIn
(
"<p>"
,
str
(
response
))
# At least check if the output shows the resource is not found
self
.
assertIn
(
"Resource not found"
,
str
(
response
))
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestERP5Core
))
...
...
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