24 lines
847 B
Python
24 lines
847 B
Python
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
|