kin: auto-commit after pipeline

This commit is contained in:
Gros Frumos 2026-03-17 15:59:43 +02:00
parent 396f5193d3
commit 18160de45e
9 changed files with 449 additions and 0 deletions

View file

@ -2174,3 +2174,28 @@ def test_get_projects_includes_test_command(client):
p1 = next((p for p in projects if p["id"] == "p1"), None)
assert p1 is not None
assert p1["test_command"] == "cargo test"
def test_patch_project_test_command_db_value_verified(client):
"""KIN-ARCH-008 decision #318: PATCH test_command сохраняет значение и в response, и в БД."""
r = client.patch("/api/projects/p1", json={"test_command": "pytest --tb=short"})
assert r.status_code == 200
assert r.json()["test_command"] == "pytest --tb=short"
from core.db import init_db
conn = init_db(api_module.DB_PATH)
row = conn.execute("SELECT test_command FROM projects WHERE id = 'p1'").fetchone()
conn.close()
assert row[0] == "pytest --tb=short"
def test_patch_project_test_command_null_returns_400(client):
"""KIN-ARCH-008: PATCH с test_command=null (и без других полей) → 400 'Nothing to update'.
null трактуется как «поле не передано»: has_any=False 400.
Это документирует текущее поведение: нет способа сбросить test_command через PATCH null.
"""
client.patch("/api/projects/p1", json={"test_command": "npm test"})
r = client.patch("/api/projects/p1", json={"test_command": None})
assert r.status_code == 400
assert "Nothing to update" in r.json()["detail"]