Добавлены тесты для критических фиксов (lock_check, UniqueViolation, escName, idx_one_running)

This commit is contained in:
2026-07-31 18:28:49 +04:00
parent c1e7c4f9aa
commit 4d3ce74c03
5 changed files with 172 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
from pathlib import Path
def test_partial_unique_index_for_one_running_exists():
init_db_path = Path(__file__).resolve().parents[1] / "site" / "db" / "init_db.py"
content = init_db_path.read_text(encoding="utf-8")
assert "CREATE UNIQUE INDEX IF NOT EXISTS idx_one_running" in content
assert "ON scenario_runs (client_id, stand) WHERE status = 'RUNNING'" in content
def test_scenario_name_escape_chain_includes_amp_backslash_quote_doublequote():
js_path = Path(__file__).resolve().parents[1] / "site" / "static" / "js" / "scenario-list.js"
content = js_path.read_text(encoding="utf-8")
expected = (
"const escName = def.name"
".replace(/&/g,'&')"
".replace(/\\\\/g,'\\\\\\\\')"
".replace(/'/g,\"\\\\'\")"
".replace(/\"/g,'"');"
)
assert expected in content