tests: Update all tests according to new update

This commit is contained in:
Karim shoair
2025-09-13 16:07:54 +03:00
parent 13d7e70cb7
commit d6844232eb
4 changed files with 3 additions and 41 deletions
@@ -4,7 +4,7 @@ import asyncio
import pytest_httpbin import pytest_httpbin
from scrapling.engines import AsyncStealthySession from scrapling.engines._browsers import AsyncStealthySession
@pytest_httpbin.use_class_based_httpbin @pytest_httpbin.use_class_based_httpbin
+1 -1
View File
@@ -3,7 +3,7 @@ import asyncio
import pytest_httpbin import pytest_httpbin
from scrapling.engines import AsyncDynamicSession from scrapling.engines._browsers import AsyncDynamicSession
@pytest_httpbin.use_class_based_httpbin @pytest_httpbin.use_class_based_httpbin
+1 -1
View File
@@ -1,8 +1,8 @@
from unittest.mock import Mock from unittest.mock import Mock
from scrapling.parser import Selector from scrapling.parser import Selector
from scrapling.engines.toolbelt import ResponseFactory, Response
from scrapling.engines.toolbelt.custom import ResponseEncoding from scrapling.engines.toolbelt.custom import ResponseEncoding
from scrapling.engines.toolbelt.convertor import ResponseFactory, Response
class TestResponseFactory: class TestResponseFactory:
-38
View File
@@ -4,7 +4,6 @@ from pathlib import Path
from scrapling.engines.toolbelt.custom import ResponseEncoding, StatusText, Response from scrapling.engines.toolbelt.custom import ResponseEncoding, StatusText, Response
from scrapling.engines.toolbelt.navigation import ( from scrapling.engines.toolbelt.navigation import (
construct_proxy_dict, construct_proxy_dict,
construct_cdp_url,
js_bypass_path js_bypass_path
) )
from scrapling.engines.toolbelt.fingerprints import ( from scrapling.engines.toolbelt.fingerprints import (
@@ -216,43 +215,6 @@ class TestConstructProxyDict:
construct_proxy_dict({"invalid": "structure"}) construct_proxy_dict({"invalid": "structure"})
class TestConstructCdpUrl:
"""Test CDP URL construction"""
def test_basic_cdp_url(self):
"""Test basic CDP URL"""
result = construct_cdp_url("ws://localhost:9222/devtools/browser")
assert result == "ws://localhost:9222/devtools/browser"
def test_cdp_url_with_params(self):
"""Test CDP URL with query parameters"""
params = {"timeout": "30000", "headless": "true"}
result = construct_cdp_url("ws://localhost:9222/devtools/browser", params)
assert "timeout=30000" in result
assert "headless=true" in result
def test_cdp_url_without_leading_slash(self):
"""Test CDP URL without a leading slash in the path"""
with pytest.raises(ValueError):
construct_cdp_url("ws://localhost:9222devtools/browser")
def test_invalid_cdp_scheme(self):
"""Test invalid CDP URL scheme"""
with pytest.raises(ValueError):
construct_cdp_url("http://localhost:9222/devtools/browser")
def test_invalid_cdp_netloc(self):
"""Test invalid CDP URL network location"""
with pytest.raises(ValueError):
construct_cdp_url("ws:///devtools/browser")
def test_malformed_cdp_url(self):
"""Test malformed CDP URL"""
with pytest.raises(ValueError):
construct_cdp_url("not-a-url")
class TestJsBypassPath: class TestJsBypassPath:
"""Test JavaScript bypass path utility""" """Test JavaScript bypass path utility"""