test: adding new tests and updating existing ones

Code Coverage is now 92%
This commit is contained in:
Karim shoair
2025-08-17 01:03:19 +03:00
parent 2f402f4835
commit 5aea62256b
11 changed files with 480 additions and 61 deletions
+6 -1
View File
@@ -24,8 +24,13 @@ class TestStealthyFetcher:
"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
}
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
@@ -63,7 +68,7 @@ class TestStealthyFetcher:
{
"network_idle": True,
"wait": 10,
"cookies": [],
"cookies": [{"name": "test", "value": "123", "domain": "example.com", "path": "/"}],
"google_search": True,
"extra_headers": {"ayo": ""},
"os_randomize": True,
+1 -1
View File
@@ -65,7 +65,7 @@ class TestDynamicFetcherAsync:
"locale": "en-US",
"extra_headers": {"ayo": ""},
"useragent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0",
"cookies": [],
"cookies": [{"name": "test", "value": "123", "domain": "example.com", "path": "/"}],
"network_idle": True,
"custom_config": {"keep_comments": False, "keep_cdata": False},
},