release: Евномия, новая версия, линейка юристов
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
import board # noqa: E402
|
||||
import core # noqa: E402
|
||||
import run # noqa: E402
|
||||
from next_helpers import make_case, only_run_dir # noqa: E402
|
||||
|
||||
|
||||
def test_dry_run_walks_all_phases(tmp_path):
|
||||
case = make_case(tmp_path / "дело с пробелом" / "cases" / "ivanov-ivan" / "demo")
|
||||
assert run.main(["--case", str(case), "--track", "FAST", "--doc", "иск", "--dry-run"]) == 0
|
||||
run_dir = only_run_dir(case)
|
||||
events = board.read_events(run_dir / "events.jsonl")
|
||||
assert [event["phase"] for event in events if event["who"] == "themiz" and event["state"] == "start"] == [phase[0] for phase in core.PHASES]
|
||||
assert {"ts", "phase", "who", "name", "action", "state"} <= events[0].keys()
|
||||
assert json.loads((run_dir / "state.json").read_text(encoding="utf-8"))["status"] == "ok"
|
||||
html = (run_dir / "board.html").read_text(encoding="utf-8")
|
||||
assert "Александр Гольмстен" in html and "refresh" not in html
|
||||
|
||||
|
||||
def test_second_run_on_same_case_refused(tmp_path):
|
||||
case = make_case(tmp_path / "cases" / "c" / "d")
|
||||
with core.Run(case, "FAST", "иск"):
|
||||
try:
|
||||
with core.Run(case, "FAST", "иск"):
|
||||
pass
|
||||
except core.Stop as error:
|
||||
assert str(error) == "прогон по делу уже идет"
|
||||
else:
|
||||
raise AssertionError("второй прогон не остановлен")
|
||||
|
||||
|
||||
def test_dry_run_state_and_events_carry_time(tmp_path):
|
||||
case = make_case(tmp_path / "cases" / "c" / "d")
|
||||
assert run.main(["--case", str(case), "--track", "FAST", "--doc", "иск", "--dry-run"]) == 0
|
||||
run_dir = only_run_dir(case)
|
||||
state = json.loads((run_dir / "state.json").read_text(encoding="utf-8"))
|
||||
assert [name for name in state["phases"]] == [phase[0] for phase in core.PHASES]
|
||||
assert all(info["status"] == "ok" and isinstance(info["ms"], int) for info in state["phases"].values())
|
||||
events = board.read_events(run_dir / "events.jsonl")
|
||||
assert all(isinstance(event["ms"], int) for event in events if event["state"] in ("ok", "fail"))
|
||||
Reference in New Issue
Block a user