kin: KIN-073 Добавить поле acceptance_criteria в таблицу tasks. При создании задачи — отдельное поле описывающее что должно быть на выходе. PM получает acceptance_criteria и использует для проверки завершённости, не путает с текущим состоянием. GUI: textarea 'Критерии приёмки' в форме создания задачи. Tester и reviewer тоже получают acceptance_criteria для проверки.
This commit is contained in:
parent
ff69d24acc
commit
a28790d194
1 changed files with 84 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
|||
"""Tests for core/db.py — schema and migration (KIN-071)."""
|
||||
"""Tests for core/db.py — schema and migration (KIN-071, KIN-073)."""
|
||||
|
||||
import sqlite3
|
||||
import pytest
|
||||
|
|
@ -200,3 +200,86 @@ def test_migrate_operations_project_with_null_path():
|
|||
assert row["path"] is None
|
||||
assert row["project_type"] == "operations"
|
||||
conn.close()
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Schema KIN-073: acceptance_criteria в таблице tasks
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class TestTasksAcceptanceCriteriaSchema:
|
||||
"""Колонка acceptance_criteria присутствует в таблице tasks."""
|
||||
|
||||
def test_schema_has_acceptance_criteria_column(self, conn):
|
||||
assert "acceptance_criteria" in _cols(conn, "tasks")
|
||||
|
||||
def test_acceptance_criteria_defaults_to_null(self, conn):
|
||||
"""Создание задачи без acceptance_criteria — поле NULL (nullable)."""
|
||||
conn.execute(
|
||||
"INSERT INTO projects (id, name, path) VALUES ('p1', 'P', '/p')"
|
||||
)
|
||||
conn.execute(
|
||||
"INSERT INTO tasks (id, project_id, title) VALUES ('t1', 'p1', 'My Task')"
|
||||
)
|
||||
conn.commit()
|
||||
row = conn.execute(
|
||||
"SELECT acceptance_criteria FROM tasks WHERE id='t1'"
|
||||
).fetchone()
|
||||
assert row["acceptance_criteria"] is None
|
||||
|
||||
def test_create_task_with_acceptance_criteria_saves_field(self, conn):
|
||||
"""Создание задачи с acceptance_criteria — значение сохраняется в БД."""
|
||||
conn.execute(
|
||||
"INSERT INTO projects (id, name, path) VALUES ('p2', 'P', '/p')"
|
||||
)
|
||||
criteria = "Поле должно сохраняться. GET возвращает значение."
|
||||
conn.execute(
|
||||
"INSERT INTO tasks (id, project_id, title, acceptance_criteria)"
|
||||
" VALUES ('t2', 'p2', 'Task with criteria', ?)",
|
||||
(criteria,),
|
||||
)
|
||||
conn.commit()
|
||||
row = conn.execute(
|
||||
"SELECT acceptance_criteria FROM tasks WHERE id='t2'"
|
||||
).fetchone()
|
||||
assert row["acceptance_criteria"] == criteria
|
||||
|
||||
def test_get_task_returns_acceptance_criteria(self, conn):
|
||||
"""SELECT задачи возвращает acceptance_criteria (критерий приёмки 3)."""
|
||||
conn.execute(
|
||||
"INSERT INTO projects (id, name, path) VALUES ('p3', 'P', '/p')"
|
||||
)
|
||||
conn.execute(
|
||||
"INSERT INTO tasks (id, project_id, title, acceptance_criteria)"
|
||||
" VALUES ('t3', 'p3', 'T', 'AC value')",
|
||||
)
|
||||
conn.commit()
|
||||
row = conn.execute("SELECT * FROM tasks WHERE id='t3'").fetchone()
|
||||
assert row["acceptance_criteria"] == "AC value"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Migration KIN-073: _migrate добавляет acceptance_criteria в старую схему
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def test_migrate_adds_acceptance_criteria_to_old_schema():
|
||||
"""_migrate добавляет acceptance_criteria в tasks если колонки нет."""
|
||||
conn = _old_schema_conn()
|
||||
_migrate(conn)
|
||||
assert "acceptance_criteria" in _cols(conn, "tasks")
|
||||
conn.close()
|
||||
|
||||
|
||||
def test_migrate_acceptance_criteria_is_nullable_after_migration():
|
||||
"""После миграции acceptance_criteria nullable — старые строки не ломаются."""
|
||||
conn = _old_schema_conn()
|
||||
conn.execute(
|
||||
"INSERT INTO projects (id, name, path) VALUES ('pm', 'P', '/p')"
|
||||
)
|
||||
conn.execute(
|
||||
"INSERT INTO tasks (id, project_id, title) VALUES ('tm', 'pm', 'Old Task')"
|
||||
)
|
||||
conn.commit()
|
||||
_migrate(conn)
|
||||
row = conn.execute("SELECT acceptance_criteria FROM tasks WHERE id='tm'").fetchone()
|
||||
assert row["acceptance_criteria"] is None
|
||||
conn.close()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue