from pathlib import Path ROOT=Path(__file__).resolve().parents[1] def test_version(): assert (ROOT/"VERSION").read_text(encoding="utf-8").strip()=="4.6.19" def test_zip_backend_routes_exist(): py=(ROOT/"routes/ocean_batch.py").read_text(encoding="utf-8") assert "async def create_ocean_batch_zip" in py assert "async def download_ocean_batch_zip" in py assert '"/api/ocean/batch/{job_id}/zip"' in py assert '"/api/ocean/batch/zip/{token}"' in py assert "manifest.json" in py def test_manifest_is_downloaded_with_authenticated_fetch(): js=(ROOT/"static/js/app.js").read_text(encoding="utf-8") assert 'data-batch-manifest' in js assert 'await j("/api/ocean/batch/"+encodeURIComponent(d.job_id)+"/manifest")' in js assert 'saveBlobWithProgress(blob,"ocean_batch_"+d.job_id+"_manifest.json"' in js def test_zip_is_primary_and_old_download_all_is_explicitly_per_file(): js=(ROOT/"static/js/app.js").read_text(encoding="utf-8") assert "打包 ZIP 下载" in js assert ">逐个下载<" in js assert "如不想逐个确认,请使用“打包 ZIP 下载”" in js