File size: 912 Bytes
55f13dd
 
 
 
0d11aa0
55f13dd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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