Merge branch 'KIN-UI-019-backend_dev'
This commit is contained in:
commit
63002a2018
2 changed files with 11 additions and 28 deletions
|
|
@ -252,21 +252,14 @@ def test_list_tasks_parent_none_filter(proj):
|
|||
# 8. API tests
|
||||
# ===========================================================================
|
||||
|
||||
def test_patch_task_revising_status(client, tmp_path):
|
||||
def test_patch_task_revising_status(client):
|
||||
"""PATCH /api/tasks/{id} status=done с открытым child → ответ содержит status='revising'."""
|
||||
import web.api as api_module
|
||||
from core.db import init_db
|
||||
from core import models as m
|
||||
|
||||
client.post("/api/projects", json={"id": "p1", "name": "P1", "path": "/p1"})
|
||||
r = client.post("/api/tasks", json={"project_id": "p1", "title": "Parent Task"})
|
||||
parent_id = r.json()["id"]
|
||||
|
||||
# Seed child directly via models (TaskCreate API has no parent_task_id field)
|
||||
conn = init_db(api_module.DB_PATH)
|
||||
m.create_task(conn, parent_id + "a", "p1", "Child Task",
|
||||
parent_task_id=parent_id, status="pending")
|
||||
conn.close()
|
||||
client.post("/api/tasks", json={"project_id": "p1", "title": "Child Task",
|
||||
"parent_task_id": parent_id})
|
||||
|
||||
r = client.patch(f"/api/tasks/{parent_id}", json={"status": "done"})
|
||||
|
||||
|
|
@ -276,19 +269,14 @@ def test_patch_task_revising_status(client, tmp_path):
|
|||
|
||||
def test_get_children_endpoint(client):
|
||||
"""GET /api/tasks/{id}/children возвращает список прямых дочерних задач."""
|
||||
import web.api as api_module
|
||||
from core.db import init_db
|
||||
from core import models as m
|
||||
|
||||
client.post("/api/projects", json={"id": "p1", "name": "P1", "path": "/p1"})
|
||||
r = client.post("/api/tasks", json={"project_id": "p1", "title": "Parent Task"})
|
||||
parent_id = r.json()["id"]
|
||||
|
||||
# Seed children via models
|
||||
conn = init_db(api_module.DB_PATH)
|
||||
m.create_task(conn, parent_id + "a", "p1", "Child A", parent_task_id=parent_id)
|
||||
m.create_task(conn, parent_id + "b", "p1", "Child B", parent_task_id=parent_id)
|
||||
conn.close()
|
||||
client.post("/api/tasks", json={"project_id": "p1", "title": "Child A",
|
||||
"parent_task_id": parent_id})
|
||||
client.post("/api/tasks", json={"project_id": "p1", "title": "Child B",
|
||||
"parent_task_id": parent_id})
|
||||
|
||||
r = client.get(f"/api/tasks/{parent_id}/children")
|
||||
|
||||
|
|
@ -307,19 +295,13 @@ def test_get_children_endpoint_not_found(client):
|
|||
|
||||
def test_list_tasks_parent_filter_api(client):
|
||||
"""GET /api/tasks?parent_task_id={id} фильтрует задачи по родителю."""
|
||||
import web.api as api_module
|
||||
from core.db import init_db
|
||||
from core import models as m
|
||||
|
||||
client.post("/api/projects", json={"id": "p1", "name": "P1", "path": "/p1"})
|
||||
r = client.post("/api/tasks", json={"project_id": "p1", "title": "Parent Task"})
|
||||
parent_id = r.json()["id"]
|
||||
client.post("/api/tasks", json={"project_id": "p1", "title": "Other Root Task"})
|
||||
|
||||
# Seed child via models
|
||||
conn = init_db(api_module.DB_PATH)
|
||||
m.create_task(conn, parent_id + "a", "p1", "Child Task", parent_task_id=parent_id)
|
||||
conn.close()
|
||||
client.post("/api/tasks", json={"project_id": "p1", "title": "Child Task",
|
||||
"parent_task_id": parent_id})
|
||||
|
||||
r = client.get(f"/api/tasks?parent_task_id={parent_id}")
|
||||
|
||||
|
|
|
|||
|
|
@ -1864,6 +1864,7 @@ def send_chat_message(project_id: str, body: ChatMessageIn):
|
|||
|
||||
DIST = Path(__file__).parent / "frontend" / "dist"
|
||||
|
||||
if (DIST / "assets").exists():
|
||||
app.mount("/assets", StaticFiles(directory=str(DIST / "assets")), name="assets")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue