Files
slack-sieve/tests/test_preset_skips.py
T
ilia 4b034d19f6
CI / skip-ci-check (push) Successful in 4s
CI / secret-scan (push) Failing after 2s
CI / python-ci (push) Successful in 25s
Add triage tests, prepare-export, and UI fixes for Levkin migration.
Cherry-pick heuristics, manifest merge, global file search, scrollbar styling, and pytest/Playwright coverage unblock review and filtered export for mmetl.
2026-06-03 15:42:48 -04:00

51 lines
1.5 KiB
Python

"""Tests for scripts/preset-skips.py."""
from __future__ import annotations
import importlib.util
import json
from pathlib import Path
import pytest
REPO = Path(__file__).resolve().parents[1]
def _load_preset_skips():
path = REPO / "scripts" / "preset-skips.py"
spec = importlib.util.spec_from_file_location("preset_skips", path)
mod = importlib.util.module_from_spec(spec)
assert spec.loader
spec.loader.exec_module(mod)
return mod
def test_load_preset_tiers():
mod = _load_preset_skips()
preset = mod.load_preset(REPO / "presets" / "levkin-skips.json")
assert "medical" in preset["skip_all"]
assert "zoey" in preset["review_priority"]
assert "29wilson" in preset["tier_b"]
def test_channel_entry_skip():
mod = _load_preset_skips()
entry = mod.channel_entry_skip("tier-a")
assert entry["status"] == "skip"
assert entry["reviewed"] is True
def test_main_writes_manifest(tmp_path, fixture_export_path, monkeypatch):
mod = _load_preset_skips()
manifest_path = tmp_path / "manifest.json"
monkeypatch.setattr(mod, "MANIFEST_PATH", manifest_path)
monkeypatch.setattr(mod, "DEFAULT_EXPORT", fixture_export_path)
import sys
sys.argv = ["preset-skips.py", str(fixture_export_path)]
assert mod.main() == 0
data = json.loads(manifest_path.read_text())
assert data["channels"]["medical"]["status"] == "skip"
assert "zoey" not in data["channels"] or data["channels"].get("zoey", {}).get("status") != "skip"