diff options
| author | Marc Abramowitz <marc@marc-abramowitz.com> | 2014-03-10 09:15:08 -0700 |
|---|---|---|
| committer | Marc Abramowitz <marc@marc-abramowitz.com> | 2014-03-10 09:15:08 -0700 |
| commit | 49bcc8e86ded6785c3bddd6972f870b2d2d858a8 (patch) | |
| tree | 4bacf5e2dbd21266a753f4215ea45b49bba0adcd | |
| parent | b4e59b7168273b774acd975457906dffa176caba (diff) | |
| download | pyramid-49bcc8e86ded6785c3bddd6972f870b2d2d858a8.tar.gz pyramid-49bcc8e86ded6785c3bddd6972f870b2d2d858a8.tar.bz2 pyramid-49bcc8e86ded6785c3bddd6972f870b2d2d858a8.zip | |
Add integration tests for Unicode in URL
| -rw-r--r-- | pyramid/tests/test_integration.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/pyramid/tests/test_integration.py b/pyramid/tests/test_integration.py index 9d3a9e004..bc22c2e54 100644 --- a/pyramid/tests/test_integration.py +++ b/pyramid/tests/test_integration.py @@ -640,6 +640,44 @@ class RendererScanAppTest(IntegrationBase, unittest.TestCase): res = testapp.get('/two', status=200) self.assertTrue(b'Two!' in res.body) +class UnicodeInURLTest(unittest.TestCase): + def _makeConfig(self): + from pyramid.config import Configurator + config = Configurator() + return config + + def _makeTestApp(self, config): + from webtest import TestApp + app = config.make_wsgi_app() + return TestApp(app) + + def test_unicode_in_url_404(self): + request_path = b'/avalia%C3%A7%C3%A3o_participante/' + request_path_unicode = u'/avalia\xe7\xe3o_participante/' + + config = self._makeConfig() + testapp = self._makeTestApp(config) + + res = testapp.get(request_path, status=404) + self.assertTrue(request_path_unicode in res.text) + + def test_unicode_in_url_200(self): + request_path = b'/avalia%C3%A7%C3%A3o_participante' + request_path_unicode = u'/avalia\xe7\xe3o_participante' + + def myview(request): + return 'XXX' + + config = self._makeConfig() + config.add_route('myroute', request_path_unicode) + config.add_view(myview, route_name='myroute', renderer='json') + testapp = self._makeTestApp(config) + + res = testapp.get(request_path, status=200) + + self.assertEqual(res.text, '"XXX"') + + class AcceptContentTypeTest(unittest.TestCase): def setUp(self): def hello_view(request): |
