summaryrefslogtreecommitdiff
path: root/tests/unit/test_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/test_utils.py')
-rw-r--r--tests/unit/test_utils.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py
index 4306d0790..4c7ebaec7 100644
--- a/tests/unit/test_utils.py
+++ b/tests/unit/test_utils.py
@@ -1,16 +1,21 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring, invalid-name
+import random
+import string
import lxml.etree
from lxml import html
from parameterized.parameterized import parameterized
from searx.exceptions import SearxXPathSyntaxException, SearxEngineXPathException
from searx import utils
-
from tests import SearxTestCase
+def random_string(length, choices=string.ascii_letters):
+ return ''.join(random.choice(choices) for _ in range(length))
+
+
class TestUtils(SearxTestCase): # pylint: disable=missing-class-docstring
def test_gen_useragent(self):
self.assertIsInstance(utils.gen_useragent(), str)
@@ -234,4 +239,4 @@ class TestXPathUtils(SearxTestCase): # pylint: disable=missing-class-docstring
self.assertIsNone(l)
with self.assertRaises(ValueError):
- utils.detect_language(None)
+ utils.detect_language(None) # type: ignore