diff options
author | Alexandre Flament <alex@al-f.net> | 2022-05-21 18:24:47 +0200 |
---|---|---|
committer | Alexandre Flament <alex@al-f.net> | 2022-07-08 22:02:21 +0200 |
commit | a1e8af0796d532d529eb9d90f315f79dfbd86b0d (patch) | |
tree | 3bf551b24162b05fe50193dd0c3079ced8698116 /tests | |
parent | 2864a67ce922ecaf3f224859ee1e4a92f0b9f8c7 (diff) | |
download | searxng-a1e8af0796d532d529eb9d90f315f79dfbd86b0d.tar.gz searxng-a1e8af0796d532d529eb9d90f315f79dfbd86b0d.zip |
bing.py: resolve bing.com/ck/a redirections
add a new function searx.network.multi_requests to send multiple HTTP requests at once
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/network/test_network.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/unit/network/test_network.py b/tests/unit/network/test_network.py index 4253e69ac..905b981c1 100644 --- a/tests/unit/network/test_network.py +++ b/tests/unit/network/test_network.py @@ -141,28 +141,28 @@ class TestNetworkRequestRetries(SearxTestCase): async def test_retries_ok(self): with patch.object(httpx.AsyncClient, 'request', new=TestNetworkRequestRetries.get_response_404_then_200()): network = Network(enable_http=True, retries=1, retry_on_http_error=403) - response = await network.request('GET', 'https://example.com/') + response = await network.request('GET', 'https://example.com/', raise_for_httperror=False) self.assertEqual(response.text, TestNetworkRequestRetries.TEXT) await network.aclose() async def test_retries_fail_int(self): with patch.object(httpx.AsyncClient, 'request', new=TestNetworkRequestRetries.get_response_404_then_200()): network = Network(enable_http=True, retries=0, retry_on_http_error=403) - response = await network.request('GET', 'https://example.com/') + response = await network.request('GET', 'https://example.com/', raise_for_httperror=False) self.assertEqual(response.status_code, 403) await network.aclose() async def test_retries_fail_list(self): with patch.object(httpx.AsyncClient, 'request', new=TestNetworkRequestRetries.get_response_404_then_200()): network = Network(enable_http=True, retries=0, retry_on_http_error=[403, 429]) - response = await network.request('GET', 'https://example.com/') + response = await network.request('GET', 'https://example.com/', raise_for_httperror=False) self.assertEqual(response.status_code, 403) await network.aclose() async def test_retries_fail_bool(self): with patch.object(httpx.AsyncClient, 'request', new=TestNetworkRequestRetries.get_response_404_then_200()): network = Network(enable_http=True, retries=0, retry_on_http_error=True) - response = await network.request('GET', 'https://example.com/') + response = await network.request('GET', 'https://example.com/', raise_for_httperror=False) self.assertEqual(response.status_code, 403) await network.aclose() @@ -178,7 +178,7 @@ class TestNetworkRequestRetries(SearxTestCase): with patch.object(httpx.AsyncClient, 'request', new=get_response): network = Network(enable_http=True, retries=2) - response = await network.request('GET', 'https://example.com/') + response = await network.request('GET', 'https://example.com/', raise_for_httperror=False) self.assertEqual(response.status_code, 200) self.assertEqual(response.text, TestNetworkRequestRetries.TEXT) await network.aclose() @@ -190,7 +190,7 @@ class TestNetworkRequestRetries(SearxTestCase): with patch.object(httpx.AsyncClient, 'request', new=get_response): network = Network(enable_http=True, retries=0) with self.assertRaises(httpx.RequestError): - await network.request('GET', 'https://example.com/') + await network.request('GET', 'https://example.com/', raise_for_httperror=False) await network.aclose() @@ -237,6 +237,6 @@ class TestNetworkStreamRetries(SearxTestCase): with patch.object(httpx.AsyncClient, 'stream', new=stream): network = Network(enable_http=True, retries=0, retry_on_http_error=403) - response = await network.stream('GET', 'https://example.com/') + response = await network.stream('GET', 'https://example.com/', raise_for_httperror=False) self.assertEqual(response.status_code, 403) await network.aclose() |