tests: Update all tests according to new update
This commit is contained in:
@@ -4,7 +4,7 @@ import asyncio
|
||||
|
||||
import pytest_httpbin
|
||||
|
||||
from scrapling.engines import AsyncStealthySession
|
||||
from scrapling.engines._browsers import AsyncStealthySession
|
||||
|
||||
|
||||
@pytest_httpbin.use_class_based_httpbin
|
||||
|
||||
@@ -3,7 +3,7 @@ import asyncio
|
||||
|
||||
import pytest_httpbin
|
||||
|
||||
from scrapling.engines import AsyncDynamicSession
|
||||
from scrapling.engines._browsers import AsyncDynamicSession
|
||||
|
||||
|
||||
@pytest_httpbin.use_class_based_httpbin
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from unittest.mock import Mock
|
||||
|
||||
from scrapling.parser import Selector
|
||||
from scrapling.engines.toolbelt import ResponseFactory, Response
|
||||
from scrapling.engines.toolbelt.custom import ResponseEncoding
|
||||
from scrapling.engines.toolbelt.convertor import ResponseFactory, Response
|
||||
|
||||
|
||||
class TestResponseFactory:
|
||||
|
||||
@@ -4,7 +4,6 @@ from pathlib import Path
|
||||
from scrapling.engines.toolbelt.custom import ResponseEncoding, StatusText, Response
|
||||
from scrapling.engines.toolbelt.navigation import (
|
||||
construct_proxy_dict,
|
||||
construct_cdp_url,
|
||||
js_bypass_path
|
||||
)
|
||||
from scrapling.engines.toolbelt.fingerprints import (
|
||||
@@ -216,43 +215,6 @@ class TestConstructProxyDict:
|
||||
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:
|
||||
"""Test JavaScript bypass path utility"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user