-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from plone/apply-hotfix-20160830-master
Apply hotfix 20160830 master
- Loading branch information
Showing
3 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from zExceptions import NotFound | ||
from plone.app.users.browser.userdatapanel import UserDataPanel | ||
from plone.app.users.testing import PLONE_APP_USERS_FUNCTIONAL_TESTING | ||
from zope.i18n import translate | ||
|
||
import unittest | ||
|
||
|
||
class TestUserDataPanel(unittest.TestCase): | ||
|
||
layer = PLONE_APP_USERS_FUNCTIONAL_TESTING | ||
|
||
def test_regression(self): | ||
portal = self.layer['portal'] | ||
request = self.layer['request'] | ||
request.form.update({ | ||
'userid': 'admin' | ||
}) | ||
form = UserDataPanel(portal, request) | ||
description = translate(form.description, context=request) | ||
self.assertTrue('admin' in description) | ||
# form can be called without raising exception. | ||
self.assertTrue(form()) | ||
|
||
def test_escape_html(self): | ||
portal = self.layer['portal'] | ||
request = self.layer['request'] | ||
request.form.update({ | ||
'userid': 'admin<script>alert("userid")</script>' | ||
}) | ||
form = UserDataPanel(portal, request) | ||
description = translate(form.description, context=request) | ||
self.assertTrue('<script>' not in description) | ||
self.assertRaises(NotFound, form) |