diff options
| author | Markus Heiser <markus.heiser@darmarIT.de> | 2021-12-29 13:33:27 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-29 13:33:27 +0100 |
| commit | 7966fd3bbdee448d5f4b532231d69310b4f91563 (patch) | |
| tree | 8bd8d530e7cb56ec511ef7f8d9071398516ba94a /tests | |
| parent | 5cbbdc305f08ff11d9b59fbf95743ebe99cf3dbf (diff) | |
| parent | 8f3a7feb47a84344a190ce83e629afde1181f6ae (diff) | |
Merge pull request #663 from dalf/mod_secret_key
changes about the secret_key
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit/test_webutils.py | 16 |
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') |