def test_url_quoting_plus(self):
        from DocumentTemplate.DT_Var import url_quote_plus
        from DocumentTemplate.DT_Var import url_unquote_plus
        unicode_value = u'G\xfcnther M\xfcller'
        quoted_unicode_value = u'G%C3%BCnther+M%C3%BCller'
        utf8_value = unicode_value.encode('UTF-8')
        quoted_utf8_value = 'G%C3%BCnther+M%C3%BCller'

        self.assertEquals(url_quote_plus(unicode_value), quoted_unicode_value)
        self.assertEquals(url_quote_plus(utf8_value), quoted_utf8_value)
        
        self.assertEquals(url_unquote_plus(quoted_unicode_value), unicode_value)
        self.assertEquals(url_unquote_plus(quoted_utf8_value), utf8_value)
Esempio n. 2
0
    def test_url_quoting_plus(self):
        from DocumentTemplate.DT_Var import url_quote_plus
        from DocumentTemplate.DT_Var import url_unquote_plus
        unicode_value = u'G\xfcnther M\xfcller'
        quoted_unicode_value = u'G%C3%BCnther+M%C3%BCller'
        utf8_value = unicode_value.encode('UTF-8')
        quoted_utf8_value = 'G%C3%BCnther+M%C3%BCller'

        self.assertEquals(url_quote_plus(unicode_value), quoted_unicode_value)
        self.assertEquals(url_quote_plus(utf8_value), quoted_utf8_value)
        
        self.assertEquals(url_unquote_plus(quoted_unicode_value), unicode_value)
        self.assertEquals(url_unquote_plus(quoted_utf8_value), utf8_value)