@@ -1,3 +1,4 @@
1+# -*- coding: utf-8 -*-
12import mock
23from searx.testing import SearxTestCase
34from searx import utils
@@ -51,6 +52,15 @@ class TestUtils(SearxTestCase):
5152 self.assertIsNotNone(utils.html_to_text(html))
5253 self.assertEqual(utils.html_to_text(html), "Test text")
5354
55+ def test_prettify_url(self):
56+ data = (('https://searx.me/', 'https://searx.me/'),
57+ (u'https://searx.me/ű', u'https://searx.me/ű'),
58+ ('https://searx.me/' + (100 * 'a'), 'https://searx.me/[...]aaaaaaaaaaaaaaaaa'),
59+ (u'https://searx.me/' + (100 * u'ű'), u'https://searx.me/[...]űűűűűűűűűűűűűűűűű'))
60+
61+ for test_url, expected in data:
62+ self.assertEqual(utils.prettify_url(test_url, max_length=32), expected)
63+
5464
5565class TestHTMLTextExtractor(SearxTestCase):
5666