From e856e0940b6bdaa4d6da737457765f00448f4ecd Mon Sep 17 00:00:00 2001 From: Dev Agent Date: Thu, 4 Jun 2026 22:38:09 +0300 Subject: [PATCH] test: migrate sequential_ids test to In Progress contract --- tests/test_webhooks.py | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/tests/test_webhooks.py b/tests/test_webhooks.py index 0ab8b0e..dfcc1fa 100644 --- a/tests/test_webhooks.py +++ b/tests/test_webhooks.py @@ -81,17 +81,37 @@ def test_plane_webhook_creates_task(mock_docs, mock_branch, mock_fetch_fields, m assert "feature/" in task["branch"] +@patch("src.plane_sync.add_comment") +@patch("src.plane_sync.fetch_issue_sequence_id", return_value=None) +@patch("src.plane_sync.fetch_issue_fields", + side_effect=[ + ("First task", "This is a detailed description for the first task item"), + ("Second task", "This is a detailed description for the second task item"), + ]) @patch("src.webhooks.plane._create_gitea_branch", new_callable=AsyncMock) @patch("src.webhooks.plane._create_initial_docs", new_callable=AsyncMock) -def test_plane_webhook_generates_sequential_ids(mock_docs, mock_branch): - """Multiple work items get sequential IDs.""" +def test_plane_webhook_generates_sequential_ids( + mock_docs, mock_branch, mock_fetch_fields, mock_fetch_seq, mock_add_comment +): + """Multiple In Progress transitions get sequential IDs (ET-001, ET-002).""" + in_progress_state = { + "id": "b873d9eb-993c-48cd-97ac-99a9b1623967", + "name": "In Progress", + "group": "started", + } client.post("/webhook/plane", json={ - "event": "work_item.created", - "data": {"id": "item-1", "name": "First task", "project": "proj-1"} + "event": "issue", "action": "updated", + "data": { + "id": "item-1", "name": "First task", "project": "proj-1", + "state": in_progress_state, + } }) client.post("/webhook/plane", json={ - "event": "work_item.created", - "data": {"id": "item-2", "name": "Second task", "project": "proj-1"} + "event": "issue", "action": "updated", + "data": { + "id": "item-2", "name": "Second task", "project": "proj-1", + "state": in_progress_state, + } }) conn = get_db()