Karim shoair commited on
Commit
309c3e5
·
1 Parent(s): a85d2c8

tests: Update all tests according to new update

Browse files
tests/fetchers/async/test_camoufox_session.py CHANGED
@@ -4,7 +4,7 @@ import asyncio
4
 
5
  import pytest_httpbin
6
 
7
- from scrapling.engines import AsyncStealthySession
8
 
9
 
10
  @pytest_httpbin.use_class_based_httpbin
 
4
 
5
  import pytest_httpbin
6
 
7
+ from scrapling.engines._browsers import AsyncStealthySession
8
 
9
 
10
  @pytest_httpbin.use_class_based_httpbin
tests/fetchers/async/test_dynamic_session.py CHANGED
@@ -3,7 +3,7 @@ import asyncio
3
 
4
  import pytest_httpbin
5
 
6
- from scrapling.engines import AsyncDynamicSession
7
 
8
 
9
  @pytest_httpbin.use_class_based_httpbin
 
3
 
4
  import pytest_httpbin
5
 
6
+ from scrapling.engines._browsers import AsyncDynamicSession
7
 
8
 
9
  @pytest_httpbin.use_class_based_httpbin
tests/fetchers/test_response_handling.py CHANGED
@@ -1,8 +1,8 @@
1
  from unittest.mock import Mock
2
 
3
  from scrapling.parser import Selector
4
- from scrapling.engines.toolbelt import ResponseFactory, Response
5
  from scrapling.engines.toolbelt.custom import ResponseEncoding
 
6
 
7
 
8
  class TestResponseFactory:
 
1
  from unittest.mock import Mock
2
 
3
  from scrapling.parser import Selector
 
4
  from scrapling.engines.toolbelt.custom import ResponseEncoding
5
+ from scrapling.engines.toolbelt.convertor import ResponseFactory, Response
6
 
7
 
8
  class TestResponseFactory:
tests/fetchers/test_utils.py CHANGED
@@ -4,7 +4,6 @@ from pathlib import Path
4
  from scrapling.engines.toolbelt.custom import ResponseEncoding, StatusText, Response
5
  from scrapling.engines.toolbelt.navigation import (
6
  construct_proxy_dict,
7
- construct_cdp_url,
8
  js_bypass_path
9
  )
10
  from scrapling.engines.toolbelt.fingerprints import (
@@ -216,43 +215,6 @@ class TestConstructProxyDict:
216
  construct_proxy_dict({"invalid": "structure"})
217
 
218
 
219
- class TestConstructCdpUrl:
220
- """Test CDP URL construction"""
221
-
222
- def test_basic_cdp_url(self):
223
- """Test basic CDP URL"""
224
- result = construct_cdp_url("ws://localhost:9222/devtools/browser")
225
- assert result == "ws://localhost:9222/devtools/browser"
226
-
227
- def test_cdp_url_with_params(self):
228
- """Test CDP URL with query parameters"""
229
- params = {"timeout": "30000", "headless": "true"}
230
- result = construct_cdp_url("ws://localhost:9222/devtools/browser", params)
231
-
232
- assert "timeout=30000" in result
233
- assert "headless=true" in result
234
-
235
- def test_cdp_url_without_leading_slash(self):
236
- """Test CDP URL without a leading slash in the path"""
237
- with pytest.raises(ValueError):
238
- construct_cdp_url("ws://localhost:9222devtools/browser")
239
-
240
- def test_invalid_cdp_scheme(self):
241
- """Test invalid CDP URL scheme"""
242
- with pytest.raises(ValueError):
243
- construct_cdp_url("http://localhost:9222/devtools/browser")
244
-
245
- def test_invalid_cdp_netloc(self):
246
- """Test invalid CDP URL network location"""
247
- with pytest.raises(ValueError):
248
- construct_cdp_url("ws:///devtools/browser")
249
-
250
- def test_malformed_cdp_url(self):
251
- """Test malformed CDP URL"""
252
- with pytest.raises(ValueError):
253
- construct_cdp_url("not-a-url")
254
-
255
-
256
  class TestJsBypassPath:
257
  """Test JavaScript bypass path utility"""
258
 
 
4
  from scrapling.engines.toolbelt.custom import ResponseEncoding, StatusText, Response
5
  from scrapling.engines.toolbelt.navigation import (
6
  construct_proxy_dict,
 
7
  js_bypass_path
8
  )
9
  from scrapling.engines.toolbelt.fingerprints import (
 
215
  construct_proxy_dict({"invalid": "structure"})
216
 
217
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  class TestJsBypassPath:
219
  """Test JavaScript bypass path utility"""
220