diff options
Diffstat (limited to 'searx/tests/test_utils.py')
-rw-r--r-- | searx/tests/test_utils.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/searx/tests/test_utils.py b/searx/tests/test_utils.py index abe411c2b..04480791d 100644 --- a/searx/tests/test_utils.py +++ b/searx/tests/test_utils.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import mock from searx.testing import SearxTestCase from searx import utils @@ -51,6 +52,15 @@ class TestUtils(SearxTestCase): self.assertIsNotNone(utils.html_to_text(html)) self.assertEqual(utils.html_to_text(html), "Test text") + def test_prettify_url(self): + data = (('https://searx.me/', 'https://searx.me/'), + (u'https://searx.me/ű', u'https://searx.me/ű'), + ('https://searx.me/' + (100 * 'a'), 'https://searx.me/[...]aaaaaaaaaaaaaaaaa'), + (u'https://searx.me/' + (100 * u'ű'), u'https://searx.me/[...]űűűűűűűűűűűűűűűűű')) + + for test_url, expected in data: + self.assertEqual(utils.prettify_url(test_url, max_length=32), expected) + class TestHTMLTextExtractor(SearxTestCase): |