Пример #1
0
    def test_url_escape(self):
        tests = [
            # byte strings are passed through as-is
            (u'\u00e9'.encode('utf8'), '%C3%A9'),
            (u'\u00e9'.encode('latin1'), '%E9'),

            # unicode strings become utf8
            (u'\u00e9', '%C3%A9'),
        ]
        for unescaped, escaped in tests:
            self.assertEqual(url_escape(unescaped), escaped)
Пример #2
0
    def test_url_escape(self):
        tests = [
            # byte strings are passed through as-is
            (u'\u00e9'.encode('utf8'), '%C3%A9'),
            (u'\u00e9'.encode('latin1'), '%E9'),

            # unicode strings become utf8
            (u'\u00e9', '%C3%A9'),
            ]
        for unescaped, escaped in tests:
            self.assertEqual(url_escape(unescaped), escaped)
Пример #3
0
 def test_task_handler(self):
     response = self.fetch('/task?url=%s' % url_escape(self.get_url('/sequence')))
     self.assertEqual(response.body, b("got response: 123"))
Пример #4
0
 def test_task_handler(self):
     response = self.fetch('/task?url=%s' %
                           url_escape(self.get_url('/sequence')))
     self.assertEqual(response.body, b("got response: 123"))