squid-main-space / tests /test_download_host_authorization_v460.py
Zin299's picture
Deploy v4.6.1 upstream download refresh retry
0d11aa0
Raw
History Blame
912 Bytes
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
def test_version():
assert (ROOT/"VERSION").read_text(encoding="utf-8").strip()=="4.6.1"
def test_batch_url_authorization_helper_exists():
py=(ROOT/"routes"/"downloads.py").read_text(encoding="utf-8")
assert "def _validated_batch_download_url" in py
assert "OCEAN_BATCH_MANAGER._read(batch_job_id)" in py
assert "hmac.compare_digest(expected,url)" in py
def test_allowlist_is_not_globally_disabled():
py=(ROOT/"routes"/"downloads.py").read_text(encoding="utf-8")
assert "if not batch_authorized and not _host_allowed" in py
assert "external download host is not allowlisted and URL was not verified" in py
def test_frontend_sends_batch_identity():
js=(ROOT/"static"/"js"/"app.js").read_text(encoding="utf-8")
assert "batch_job_id:state.batch_job_id" in js
assert "subtask_id:file.subtask_id" in js