mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-05 15:35:06 +00:00
refactor(downloader): put one transport adapter per HTTP session kind under download()
This commit is contained in:
@@ -145,6 +145,18 @@ def test_stalled_body_times_out_and_retries(tmp_path, server, make_session, monk
|
||||
assert len(server.hits) == 2
|
||||
|
||||
|
||||
@pytest.mark.parametrize("make_session", SESSIONS)
|
||||
def test_transport_body_reads_headers_in_any_case(server, make_session):
|
||||
body = dl.transport_for(make_session()).get(f"{server.url}/plain", headers={"Range": "bytes=0-9"})
|
||||
try:
|
||||
assert body.status_code == 206
|
||||
assert body.header("content-range") == body.header("CONTENT-RANGE") == f"bytes 0-9/{len(BODY)}"
|
||||
assert body.content_length == 10
|
||||
assert b"".join(body.chunks(4, None)) == BODY[:10]
|
||||
finally:
|
||||
body.close()
|
||||
|
||||
|
||||
def test_complete_file_is_reported_without_a_request(tmp_path, server):
|
||||
save_path = tmp_path / "0.mp4"
|
||||
save_path.write_bytes(b"x" * 10)
|
||||
|
||||
Reference in New Issue
Block a user