diff options
author | Alexandre Flament <alex@al-f.net> | 2021-03-18 19:59:01 +0100 |
---|---|---|
committer | Alexandre Flament <alex@al-f.net> | 2021-04-10 15:38:33 +0200 |
commit | eaa694fb7d0e47b943bc6d6edb6cb6a40ab2d85e (patch) | |
tree | 024786c8a7003be24bbc566cb8c8e734a143f99d /tests | |
parent | 111180705b6f3b142732eb6325de1346f6372828 (diff) | |
download | searxng-eaa694fb7d0e47b943bc6d6edb6cb6a40ab2d85e.tar.gz searxng-eaa694fb7d0e47b943bc6d6edb6cb6a40ab2d85e.zip |
[enh] replace requests by httpx
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/test_poolrequests.py | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/tests/unit/test_poolrequests.py b/tests/unit/test_poolrequests.py index b22685fd0..3063ebcbd 100644 --- a/tests/unit/test_poolrequests.py +++ b/tests/unit/test_poolrequests.py @@ -1,9 +1,5 @@ -from unittest.mock import patch -from requests.models import Response - from searx.testing import SearxTestCase -import searx.poolrequests from searx.poolrequests import get_proxy_cycles, get_proxies @@ -64,26 +60,3 @@ class TestProxy(SearxTestCase): 'http': 'http://localhost:9092', 'https': 'http://localhost:9093' }) - - @patch('searx.poolrequests.get_global_proxies') - def test_request(self, mock_get_global_proxies): - method = 'GET' - url = 'http://localhost' - custom_proxies = { - 'https': 'http://localhost:1080' - } - global_proxies = { - 'http': 'http://localhost:9092', - 'https': 'http://localhost:9093' - } - mock_get_global_proxies.return_value = global_proxies - - # check the global proxies usage - with patch.object(searx.poolrequests.SessionSinglePool, 'request', return_value=Response()) as mock_method: - searx.poolrequests.request(method, url) - mock_method.assert_called_once_with(method=method, url=url, proxies=global_proxies) - - # check if the proxies parameter overrides the global proxies - with patch.object(searx.poolrequests.SessionSinglePool, 'request', return_value=Response()) as mock_method: - searx.poolrequests.request(method, url, proxies=custom_proxies) - mock_method.assert_called_once_with(method=method, url=url, proxies=custom_proxies) |