kin: KIN-008 Добавить возможность смены приоритетности и типа задачи руками из тасков
This commit is contained in:
parent
77ed68c2b5
commit
a48892d456
4 changed files with 166 additions and 4 deletions
|
|
@ -845,3 +845,58 @@ def test_patch_task_empty_body_still_returns_400(client):
|
|||
"""Пустое тело по-прежнему возвращает 400 (регрессия KIN-008)."""
|
||||
r = client.patch("/api/tasks/P1-001", json={})
|
||||
assert r.status_code == 400
|
||||
|
||||
|
||||
# PATCH /api/tasks/{id} — редактирование title и brief_text (KIN-015)
|
||||
|
||||
def test_patch_task_title(client):
|
||||
"""PATCH title обновляет заголовок задачи."""
|
||||
r = client.patch("/api/tasks/P1-001", json={"title": "Новый заголовок"})
|
||||
assert r.status_code == 200
|
||||
assert r.json()["title"] == "Новый заголовок"
|
||||
|
||||
|
||||
def test_patch_task_title_persisted(client):
|
||||
"""PATCH title сохраняется в БД."""
|
||||
client.patch("/api/tasks/P1-001", json={"title": "Персистентный заголовок"})
|
||||
r = client.get("/api/tasks/P1-001")
|
||||
assert r.json()["title"] == "Персистентный заголовок"
|
||||
|
||||
|
||||
def test_patch_task_title_empty_returns_400(client):
|
||||
"""Пустой title → 400."""
|
||||
r = client.patch("/api/tasks/P1-001", json={"title": " "})
|
||||
assert r.status_code == 400
|
||||
|
||||
|
||||
def test_patch_task_brief_text(client):
|
||||
"""PATCH brief_text сохраняется в brief.text."""
|
||||
r = client.patch("/api/tasks/P1-001", json={"brief_text": "Описание задачи"})
|
||||
assert r.status_code == 200
|
||||
assert r.json()["brief"]["text"] == "Описание задачи"
|
||||
|
||||
|
||||
def test_patch_task_brief_text_persisted(client):
|
||||
"""PATCH brief_text сохраняется в БД."""
|
||||
client.patch("/api/tasks/P1-001", json={"brief_text": "Сохранённое описание"})
|
||||
r = client.get("/api/tasks/P1-001")
|
||||
assert r.json()["brief"]["text"] == "Сохранённое описание"
|
||||
|
||||
|
||||
def test_patch_task_brief_text_merges_route_type(client):
|
||||
"""brief_text не перезаписывает route_type в brief."""
|
||||
client.patch("/api/tasks/P1-001", json={"route_type": "feature"})
|
||||
client.patch("/api/tasks/P1-001", json={"brief_text": "Описание"})
|
||||
r = client.get("/api/tasks/P1-001")
|
||||
brief = r.json()["brief"]
|
||||
assert brief["text"] == "Описание"
|
||||
assert brief["route_type"] == "feature"
|
||||
|
||||
|
||||
def test_patch_task_title_and_brief_text_together(client):
|
||||
"""PATCH может обновить title и brief_text одновременно."""
|
||||
r = client.patch("/api/tasks/P1-001", json={"title": "Совместное", "brief_text": "и описание"})
|
||||
assert r.status_code == 200
|
||||
data = r.json()
|
||||
assert data["title"] == "Совместное"
|
||||
assert data["brief"]["text"] == "и описание"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue