test_legacy_paths.py 619 B

12345678910111213141516171819
  1. from __future__ import annotations
  2. from scripts.serve_old_web import LegacyDemoHandler, _data_root
  3. def test_serve_old_web_data_root_uses_ck_data_dir(tmp_path, monkeypatch):
  4. legacy = tmp_path / "legacy_data"
  5. monkeypatch.setenv("CK_DATA_DIR", str(legacy))
  6. assert _data_root() == legacy
  7. def test_serve_old_web_maps_data_url_to_legacy_root(tmp_path, monkeypatch):
  8. legacy = tmp_path / "legacy_data"
  9. monkeypatch.setenv("CK_DATA_DIR", str(legacy))
  10. mapped = LegacyDemoHandler.translate_path(object(), "/data/demo/x/image_1.webp")
  11. assert mapped == str(legacy / "demo" / "x" / "image_1.webp")