tests: Multiple changes to tests
- Remove all tests for the old encoding logic - Stop using the `nopecha` test page to test Cloudflare solver - Remove useless tests like testing for infinite timeout - Fixes to make the code compatible with new changes
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from playwright._impl._errors import TimeoutError
|
||||
import pytest
|
||||
import pytest_httpbin
|
||||
|
||||
@@ -23,14 +24,9 @@ class TestStealthyFetcher:
|
||||
"basic_url": f"{url}/get",
|
||||
"html_url": f"{url}/html",
|
||||
"delayed_url": f"{url}/delay/10", # 10 Seconds delay response
|
||||
"cookies_url": f"{url}/cookies/set/test/value",
|
||||
"cloudflare_url": "https://nopecha.com/demo/cloudflare", # Interactive turnstile page
|
||||
"cookies_url": f"{url}/cookies/set/test/value"
|
||||
}
|
||||
|
||||
async def test_cloudflare_fetch(self, fetcher, urls):
|
||||
"""Test if Cloudflare bypass is working"""
|
||||
assert (await fetcher.async_fetch(urls["cloudflare_url"], solve_cloudflare=True)).status == 200
|
||||
|
||||
async def test_basic_fetch(self, fetcher, urls):
|
||||
"""Test doing a basic fetch request with multiple statuses"""
|
||||
assert (await fetcher.async_fetch(urls["status_200"])).status == 200
|
||||
@@ -86,9 +82,3 @@ class TestStealthyFetcher:
|
||||
**kwargs
|
||||
)
|
||||
assert response.status == 200
|
||||
|
||||
async def test_infinite_timeout(self, fetcher, urls):
|
||||
"""Test if infinite timeout breaks the code or not"""
|
||||
assert (
|
||||
await fetcher.async_fetch(urls["delayed_url"], timeout=0)
|
||||
).status == 200
|
||||
|
||||
@@ -90,9 +90,3 @@ class TestDynamicFetcherAsync:
|
||||
|
||||
with pytest.raises(Exception):
|
||||
await fetcher.async_fetch(urls["html_url"], cdp_url="ws://blahblah")
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_infinite_timeout(self, fetcher, urls):
|
||||
"""Test if infinite timeout breaks the code or not"""
|
||||
response = await fetcher.async_fetch(urls["delayed_url"], timeout=0)
|
||||
assert response.status == 200
|
||||
|
||||
Reference in New Issue
Block a user