Beispiel #1
0
 def test_with_query_params_in_url_unicode(self):
     # FIXME: This breaks. See issue #4
     # https://bitbucket.org/monwara/django-url-tools/issue/4/
     u = UrlHelper('/foo')
     u.update_query_data(redir='/foo/bar/?q=два+слова')
     self.assertEqual(u.get_query_string(safe='/'),
                      'redir=/foo/bar/%3Fq%3D%D0%B4%D0%B2%D0%B0%2B%D1%81%D0%BB%D0')
 def test_with_query_params_in_url_unicode(self):
     # FIXME: This breaks. See issue #4
     # https://bitbucket.org/monwara/django-url-tools/issue/4/
     u = UrlHelper('/foo')
     u.update_query_data(redir='/foo/bar/?q=два+слова')
     self.assertEqual(u.get_query_string(safe='/'),
                      'redir=/foo/bar/%3Fq%3D%D0%B4%D0%B2%D0%B0%2B%D1%81%D0%BB%D0')
 def test_get_query_with_multiple_values_unicode(self):
     u = UrlHelper('/foo')
     u.update_query_data(foo=[1, 2, 'слово'])
     self.assertEqual(u.get_query_string(),
                      'foo=1&foo=2&foo=%D1%81%D0%BB%D0%BE%D0%B2%D0%BE')
 def test_get_query_with_multiple_values(self):
     u = UrlHelper('/foo')
     u.update_query_data(foo=[1, 2, 3])
     self.assertEqual(u.get_query_string(), 'foo=1&foo=2&foo=3')
 def test_url_helper_get_query_string(self):
     u = UrlHelper('/foo?foo=1&bar=2')
     self.assertEqual(u.get_query_string(), 'foo=1&bar=2')
 def test_get_query_string_after_modification_unicode(self):
     u = UrlHelper('/foo?foo=1&bar=2')
     u.update_query_data(foo='слово')
     self.assertEqual(u.get_query_string(),
                      'foo=%D1%81%D0%BB%D0%BE%D0%B2%D0%BE&bar=2')
 def test_get_query_string_after_modification(self):
     u = UrlHelper('/foo?foo=1&bar=2')
     u.update_query_data(foo=2)
     self.assertEqual(u.get_query_string(), 'foo=2&bar=2')
 def test_url_helper_get_query_string_unicode(self):
     u = UrlHelper('/foo?foo=1&bar=слово')
     self.assertEqual(u.get_query_string(),
                      'foo=1&bar=%D1%81%D0%BB%D0%BE%D0%B2%D0%BE')
 def test_url_helper_get_query_string_unicode(self):
     u = UrlHelper('/foo?foo=1&bar=слово')
     self.assertEqual(u.get_query_string(),
                      'foo=1&bar=%D1%81%D0%BB%D0%BE%D0%B2%D0%BE')
 def test_with_query_params_in_url(self):
     u = UrlHelper('/foo')
     u.update_query_data(redir='/foo/bar/?q=Mickey+Mouse')
     self.assertEqual(u.get_query_string(safe='/'),
                      'redir=/foo/bar/%3Fq%3DMickey%2BMouse')
 def test_safe_slash_argument(self):
     u = UrlHelper('/foo')
     u.update_query_data(redir='/foo/bar/')
     self.assertEqual(u.get_query_string(safe='/'), 'redir=/foo/bar/')
 def test_get_query_with_multiple_values_unicode(self):
     u = UrlHelper('/foo')
     u.update_query_data(foo=[1, 2, 'слово'])
     self.assertEqual(u.get_query_string(),
                      'foo=1&foo=2&foo=%D1%81%D0%BB%D0%BE%D0%B2%D0%BE')
 def test_get_query_with_multiple_values(self):
     u = UrlHelper('/foo')
     u.update_query_data(foo=[1, 2, 3])
     self.assertEqual(u.get_query_string(), 'foo=1&foo=2&foo=3')
 def test_get_query_string_after_modification_unicode(self):
     u = UrlHelper('/foo?foo=1&bar=2')
     u.update_query_data(foo='слово')
     self.assertEqual(u.get_query_string(),
                      'foo=%D1%81%D0%BB%D0%BE%D0%B2%D0%BE&bar=2')
 def test_get_query_string_after_modification(self):
     u = UrlHelper('/foo?foo=1&bar=2')
     u.update_query_data(foo=2)
     self.assertEqual(u.get_query_string(), 'foo=2&bar=2')
 def test_safe_slash_argument(self):
     u = UrlHelper('/foo')
     u.update_query_data(redir='/foo/bar/')
     self.assertEqual(u.get_query_string(safe='/'), 'redir=/foo/bar/')
 def test_with_query_params_in_url(self):
     u = UrlHelper('/foo')
     u.update_query_data(redir='/foo/bar/?q=Mickey+Mouse')
     self.assertEqual(u.get_query_string(safe='/'),
                      'redir=/foo/bar/%3Fq%3DMickey%2BMouse')
 def test_url_helper_get_query_string(self):
     u = UrlHelper('/foo?foo=1&bar=2')
     self.assertEqual(u.get_query_string(), 'foo=1&bar=2')