summaryrefslogtreecommitdiff
path: root/tests/unit/test_webutils.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-12-28 10:14:38 +0100
committerAlexandre Flament <alex@al-f.net>2021-12-28 10:14:38 +0100
commit7d4834ac4dd708b87187caff8eb59e783e8c2111 (patch)
treef3a27c9cc2feaa9f0ac83fad80f176e9bdb63639 /tests/unit/test_webutils.py
parentd7848702097ca6a3e8630ca6d46210abf7314673 (diff)
downloadsearxng-7d4834ac4dd708b87187caff8eb59e783e8c2111.tar.gz
searxng-7d4834ac4dd708b87187caff8eb59e783e8c2111.zip
[mod] webutils.py: remove dead code
secret_key can't be bytes (see settings_default.py)
Diffstat (limited to 'tests/unit/test_webutils.py')
-rw-r--r--tests/unit/test_webutils.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/unit/test_webutils.py b/tests/unit/test_webutils.py
index 2b7c6fe5a..31a0f86ce 100644
--- a/tests/unit/test_webutils.py
+++ b/tests/unit/test_webutils.py
@@ -78,10 +78,12 @@ class TestUnicodeWriter(SearxTestCase):
class TestNewHmac(SearxTestCase):
def test_bytes(self):
- for secret_key in ['secret', b'secret', 1]:
- if secret_key == 1:
- with self.assertRaises(TypeError):
- webutils.new_hmac(secret_key, b'http://example.com')
- continue
- res = webutils.new_hmac(secret_key, b'http://example.com')
- self.assertEqual(res, '23e2baa2404012a5cc8e4a18b4aabf0dde4cb9b56f679ddc0fd6d7c24339d819')
+ data = b'http://example.com'
+ with self.assertRaises(AttributeError):
+ webutils.new_hmac(b'secret', data)
+
+ with self.assertRaises(AttributeError):
+ webutils.new_hmac(1, data)
+
+ res = webutils.new_hmac('secret', data)
+ self.assertEqual(res, '23e2baa2404012a5cc8e4a18b4aabf0dde4cb9b56f679ddc0fd6d7c24339d819')