from __future__ import annotations from scripts.serve_old_web import LegacyDemoHandler, _data_root def test_serve_old_web_data_root_uses_ck_data_dir(tmp_path, monkeypatch): legacy = tmp_path / "legacy_data" monkeypatch.setenv("CK_DATA_DIR", str(legacy)) assert _data_root() == legacy def test_serve_old_web_maps_data_url_to_legacy_root(tmp_path, monkeypatch): legacy = tmp_path / "legacy_data" monkeypatch.setenv("CK_DATA_DIR", str(legacy)) mapped = LegacyDemoHandler.translate_path(object(), "/data/demo/x/image_1.webp") assert mapped == str(legacy / "demo" / "x" / "image_1.webp")