diff options
| author | Kang-min Liu <gugod@gugod.org> | 2015-11-14 00:05:44 +0100 |
|---|---|---|
| committer | Kang-min Liu <gugod@gugod.org> | 2015-11-14 00:05:44 +0100 |
| commit | ac8759cd3ff99024864fd04d7c4bef5c3a00b971 (patch) | |
| tree | 30c3f8b61504532df926bbffedcc8df80a8e926e /searx/tests/test_utils.py | |
| parent | c7c6c35ccd7373d2107b70b92badb9b70d31905f (diff) | |
| parent | e98aef6fc4954681e58d774203d522f0ae478004 (diff) | |
Merge remote-tracking branch 'origin/master'
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): |