Chiusura fase di ristrutturazione e modularizzazione del workflow per favorire sviluppo modulare
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import threading
|
||||
import socket
|
||||
import threading
|
||||
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
from typing import ClassVar
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -12,8 +13,8 @@ class Handler(BaseHTTPRequestHandler):
|
||||
etag_requests = 0
|
||||
etag_body_responses = 0
|
||||
redirect_target = "/redirected-v1"
|
||||
redirect_request_validators = []
|
||||
final_request_validators = []
|
||||
redirect_request_validators: ClassVar[list[str | None]] = []
|
||||
final_request_validators: ClassVar[list[tuple[str, str | None]]] = []
|
||||
|
||||
def do_GET(self):
|
||||
if self.path.startswith("/etag"):
|
||||
@@ -198,7 +199,6 @@ class FakeSocket:
|
||||
|
||||
class FakeResponse:
|
||||
status_code = 200
|
||||
headers = {}
|
||||
is_redirect = False
|
||||
|
||||
def __init__(self, *, peer="127.0.0.1", stream_error=None, location=None):
|
||||
@@ -214,6 +214,7 @@ class FakeResponse:
|
||||
self.is_redirect = False
|
||||
self.status_code = 200
|
||||
self.headers = {}
|
||||
self.headers = {}
|
||||
|
||||
def iter_content(self, chunk_size):
|
||||
if self.stream_error:
|
||||
@@ -265,7 +266,7 @@ def test_http_closes_response_when_streaming_fails():
|
||||
source = HttpManifestEvidenceSource(
|
||||
["https://example.test/doc"], allow_private_hosts=True
|
||||
)
|
||||
response = FakeResponse(stream_error=socket.timeout("read timed out"))
|
||||
response = FakeResponse(stream_error=TimeoutError("read timed out"))
|
||||
source._session = FakeSession(response)
|
||||
with pytest.raises(EvidenceSourceError):
|
||||
list(source.discover())
|
||||
|
||||
Reference in New Issue
Block a user