update retention policy to a maximum of 2 days for completed archives and adjust related configurations
This commit is contained in:
+16
-1
@@ -19,6 +19,8 @@ def test_capture_routes_are_scoped_to_the_browser_session(tmp_path, monkeypatch)
|
||||
artifacts_dir=tmp_path / "artifacts",
|
||||
reports_dir=tmp_path / "reports",
|
||||
worker_enabled=False,
|
||||
default_retention_days=2,
|
||||
max_retention_days=2,
|
||||
)
|
||||
test_settings.ensure_directories()
|
||||
test_database = Database(test_settings.database_path)
|
||||
@@ -31,7 +33,8 @@ def test_capture_routes_are_scoped_to_the_browser_session(tmp_path, monkeypatch)
|
||||
with TestClient(main.app) as client:
|
||||
homepage = client.get("/")
|
||||
assert homepage.status_code == 200
|
||||
assert "Copy the web." in homepage.text
|
||||
assert "Archive the web." in homepage.text
|
||||
assert "Website Downloader & Offline Archive Tool" in homepage.text
|
||||
assert client.get("/api/captures").status_code == 401
|
||||
|
||||
created = client.post(
|
||||
@@ -50,6 +53,18 @@ def test_capture_routes_are_scoped_to_the_browser_session(tmp_path, monkeypatch)
|
||||
assert created_job["options"]["parallel_connections"] == 2
|
||||
assert created_job["options"]["download_asset_types"] == ["styles", "images"]
|
||||
assert created_job["options"]["skip_file_types"] == ["pdf", "zip"]
|
||||
assert created_job["options"]["retention_days"] == 2
|
||||
|
||||
capabilities = client.get("/api/capabilities")
|
||||
assert capabilities.status_code == 200
|
||||
assert capabilities.json()["limits"]["max_retention_days"] == 2
|
||||
|
||||
rejected_retention = client.post(
|
||||
"/api/captures",
|
||||
headers={"X-SiteHarbor-Session": owner_a},
|
||||
json={"url": "https://example.com", "retention_days": 3},
|
||||
)
|
||||
assert rejected_retention.status_code == 422
|
||||
|
||||
assert client.get(
|
||||
f"/api/captures/{job_id}", headers={"X-SiteHarbor-Session": owner_b}
|
||||
|
||||
Reference in New Issue
Block a user