You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by ke...@apache.org on 2020/01/24 18:59:04 UTC

[allura] 11/13: [#7878] encode form submits in tests

This is an automated email from the ASF dual-hosted git repository.

kentontaylor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 7c0fe3512dde4702479a78cec33a2833d27fa102
Author: Dave Brondsema <db...@slashdotmedia.com>
AuthorDate: Fri Jan 17 16:42:21 2020 +0000

    [#7878] encode form submits in tests
---
 Allura/allura/tests/functional/test_feeds.py            |  8 ++++----
 Allura/allura/tests/functional/test_rest.py             |  8 ++++----
 ForgeTracker/forgetracker/tests/functional/test_root.py | 16 +++++++++-------
 3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/Allura/allura/tests/functional/test_feeds.py b/Allura/allura/tests/functional/test_feeds.py
index 863e9a2..16e3f5d 100644
--- a/Allura/allura/tests/functional/test_feeds.py
+++ b/Allura/allura/tests/functional/test_feeds.py
@@ -46,16 +46,16 @@ class TestFeeds(TestController):
                     status='open',
                     description='This is a description'))),
             status=302)
-        title = 'Descri\xe7\xe3o e Arquitetura'.encode('utf-8')
+        title = 'Descri\xe7\xe3o e Arquitetura'
         self.app.post(
-            '/wiki/%s/update' % title,
+            h.urlquote('/wiki/%s/update' % title),
             params=dict(
-                title=title,
+                title=title.encode('utf-8'),
                 text="Nothing much",
                 labels='',
             ),
             status=302)
-        self.app.get('/wiki/%s/' % title)
+        self.app.get(h.urlquote('/wiki/%s/' % title))
 
     def test_project_feed(self):
         self.app.get('/feed.rss')
diff --git a/Allura/allura/tests/functional/test_rest.py b/Allura/allura/tests/functional/test_rest.py
index 7cbff40..892db1d 100644
--- a/Allura/allura/tests/functional/test_rest.py
+++ b/Allura/allura/tests/functional/test_rest.py
@@ -310,15 +310,15 @@ class TestRestHome(TestRestApiBase):
 
     def test_unicode(self):
         self.app.post(
-            '/wiki/tést/update',
+            h.urlquote('/wiki/tést/update'),
             params={
-                'title': 'tést',
+                'title': 'tést'.encode('utf-8'),
                 'text': 'sometext',
                 'labels': '',
                 })
-        r = self.api_get('/rest/p/test/wiki/tést/')
+        r = self.api_get(h.urlquote('/rest/p/test/wiki/tést/'))
         assert r.status_int == 200
-        assert r.json['title'].encode('utf-8') == 'tést', r.json
+        assert r.json['title'] == 'tést', r.json
 
     @td.with_wiki
     def test_deny_access(self):
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 8d624af..396d01c 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -1129,7 +1129,7 @@ class TestFunctionalController(TrackerTestController):
         params = dict(
             custom_fields=[
                 dict(name='_testselect', label='Test', type='select',
-                     options='oné "one and á half" two'),
+                     options='oné "one and á half" two'.encode('utf-8')),
             ],
             open_status_names='aa bb',
             closed_status_names='cc',
@@ -1138,15 +1138,17 @@ class TestFunctionalController(TrackerTestController):
             '/admin/bugs/set_custom_fields',
             params=variable_encode(params))
         r = self.app.get('/bugs/new/')
-        assert '<option value="oné">oné</option>'.encode('utf-8') in r
-        assert '<option value="one and á half">one and á half</option>'.encode('utf-8') in r
-        assert '<option value="two">two</option>' in r
+
+        r.mustcontain('<option value="oné">oné</option>')
+        assert '<option value="oné">oné</option>' in r.text
+        assert '<option value="one and á half">one and á half</option>' in r.text
+        assert '<option value="two">two</option>' in r.text
 
     def test_select_custom_field_invalid_quotes(self):
         params = dict(
             custom_fields=[
                 dict(name='_testselect', label='Test', type='select',
-                     options='closéd "quote missing'),
+                     options='closéd "quote missing'.encode('utf-8')),
             ],
             open_status_names='aa bb',
             closed_status_names='cc',
@@ -1203,7 +1205,7 @@ class TestFunctionalController(TrackerTestController):
                 show_in_search='on',
                 type='milestone',
                 milestones=[
-                    dict(name='aaaé'),
+                    dict(name='aaaé'.encode('utf-8')),
                     dict(name='bbb'),
                     dict(name='ccc')])]}
         self.app.post('/admin/bugs/set_custom_fields',
@@ -1244,7 +1246,7 @@ class TestFunctionalController(TrackerTestController):
         self.app.post('/bugs/update_milestones', {
             'field_name': '_milestone',
             'milestones-0.old_name': '1.0',
-            'milestones-0.new_name': 'zzzé',
+            'milestones-0.new_name': 'zzzé'.encode('utf-8'),
             'milestones-0.description': '',
             'milestones-0.complete': 'Open',
             'milestones-0.due_date': ''