mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
100% Coverage
This commit is contained in:
@@ -154,3 +154,54 @@ def test_i_am_blocked_rejects_empty_reason() -> None:
|
||||
)
|
||||
|
||||
assert resp.status_code == _HTTP_422
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_submit_for_qa_dispatches_task_id() -> None:
|
||||
"""POST submit_for_qa forwards task_id."""
|
||||
mock_chore = MagicMock()
|
||||
mock_chore.submit_for_qa = AsyncMock(
|
||||
return_value=_make_envelope(status="awaiting_qa", task_id=_TASK_ID)
|
||||
)
|
||||
client = TestClient(_build_app(mock_chore))
|
||||
resp = client.post(
|
||||
"/api/v2/flow/developer/submit_for_qa",
|
||||
json={"task_id": _TASK_ID},
|
||||
headers=_HEADERS,
|
||||
)
|
||||
assert resp.status_code == _HTTP_200
|
||||
mock_chore.submit_for_qa.assert_awaited_once()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_unclaim_dispatches_task_id() -> None:
|
||||
"""POST unclaim forwards task_id."""
|
||||
mock_chore = MagicMock()
|
||||
mock_chore.unclaim = AsyncMock(
|
||||
return_value=_make_envelope(status="pending", task_id=_TASK_ID)
|
||||
)
|
||||
client = TestClient(_build_app(mock_chore))
|
||||
resp = client.post(
|
||||
"/api/v2/flow/developer/unclaim",
|
||||
json={"task_id": _TASK_ID},
|
||||
headers=_HEADERS,
|
||||
)
|
||||
assert resp.status_code == _HTTP_200
|
||||
mock_chore.unclaim.assert_awaited_once()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_resume_dispatches_task_id() -> None:
|
||||
"""POST resume forwards task_id."""
|
||||
mock_chore = MagicMock()
|
||||
mock_chore.resume = AsyncMock(
|
||||
return_value=_make_envelope(status="in_progress", task_id=_TASK_ID)
|
||||
)
|
||||
client = TestClient(_build_app(mock_chore))
|
||||
resp = client.post(
|
||||
"/api/v2/flow/developer/resume",
|
||||
json={"task_id": _TASK_ID},
|
||||
headers=_HEADERS,
|
||||
)
|
||||
assert resp.status_code == _HTTP_200
|
||||
mock_chore.resume.assert_awaited_once()
|
||||
|
||||
Reference in New Issue
Block a user