mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-06 07:55:10 +00:00
test: delete slow, timing-based and redundant tests
This commit is contained in:
@@ -106,22 +106,6 @@ def test_download_with_flag_bypasses_proxy(server, monkeypatch) -> None:
|
||||
assert attachment.path is not None and attachment.path.read_bytes() == BODY
|
||||
|
||||
|
||||
def test_download_with_proxy_download_uses_only_that_proxy(server, monkeypatch) -> None:
|
||||
seen: dict = {}
|
||||
|
||||
def fake_direct(session, proxy=None):
|
||||
seen["proxy"] = proxy
|
||||
return Recorder()
|
||||
|
||||
monkeypatch.setattr(track_module, "direct_session", fake_direct)
|
||||
proxied = Recorder(proxies={"https": "http://manifest-proxy:1"})
|
||||
attachment = Attachment.from_url(url(server), name="thumbnail", session=proxied)
|
||||
attachment.download(proxied, proxy_download="http://dl-proxy:2")
|
||||
assert not proxied.got
|
||||
assert seen["proxy"] == "http://dl-proxy:2"
|
||||
assert proxied.proxies == {"https": "http://manifest-proxy:1"}
|
||||
|
||||
|
||||
def test_no_proxy_download_wins_over_proxy_download(server, monkeypatch) -> None:
|
||||
seen: dict = {}
|
||||
monkeypatch.setattr(track_module, "direct_session", lambda s, proxy=None: seen.setdefault("p", proxy) or Recorder())
|
||||
@@ -170,13 +154,6 @@ def test_direct_session_routes_through_the_given_proxy() -> None:
|
||||
assert requests.utils.select_proxy("https://cdn.example.com/a", new.proxies) == "http://dl-proxy:2"
|
||||
|
||||
|
||||
def test_direct_session_proxy_beats_environment(monkeypatch) -> None:
|
||||
monkeypatch.setenv("HTTPS_PROXY", "http://env-proxy:9")
|
||||
new = track_module.direct_session(requests.Session(), "http://dl-proxy:2")
|
||||
settings = new.merge_environment_settings("https://cdn.example.com/a", {}, None, None, None)
|
||||
assert settings["proxies"]["https"] == "http://dl-proxy:2"
|
||||
|
||||
|
||||
def test_direct_session_copies_rnet_cookies_set_by_name() -> None:
|
||||
from unshackle.core.session import RnetSession
|
||||
|
||||
|
||||
Reference in New Issue
Block a user