forked from Rockachopa/Timmy-time-dashboard
Round 2+3 bug fix batch: 1. Ollama timeout: Add request_timeout=300 to prevent socket read errors on complex 30-60s prompts (production crash fix) 2. Memory API: Create missing HTMX partial templates (memory_facts.html, memory_results.html) so Save/Search buttons work 3. CALM page: Add create_tables() call so SQLAlchemy tables exist on first request (was returning HTTP 500) 4. Task Queue: Full SQLite-backed rebuild with CRUD endpoints, HTMX partials, and action buttons (approve/veto/pause/cancel/retry) 5. Work Orders: Full SQLite-backed rebuild with submit/approve/reject/ execute pipeline and HTMX polling partials 6. Memory READ tool: Add memory_read function so Timmy stops calling read_file when trying to recall stored facts Also: Close GitHub issues #115, #114, #112, #110 as won't-fix. Comment on #107 confirming prune_memories() already wired to startup. Tests: 33 new tests across 4 test files, all passing. Full suite: 1155 passed, 2 pre-existing failures (hands_shell). Co-authored-by: Trip T <trip@local> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
65 lines
2.1 KiB
Python
65 lines
2.1 KiB
Python
"""Tests for the Work Orders API endpoints."""
|
|
|
|
|
|
def test_work_orders_page_returns_200(client):
|
|
response = client.get("/work-orders/queue")
|
|
assert response.status_code == 200
|
|
assert "WORK ORDERS" in response.text
|
|
|
|
|
|
def test_submit_work_order(client):
|
|
"""POST /work-orders/submit creates a work order."""
|
|
response = client.post("/work-orders/submit", data={
|
|
"title": "Fix the dashboard",
|
|
"description": "Details here",
|
|
"priority": "high",
|
|
"category": "bug",
|
|
"submitter": "dashboard",
|
|
"related_files": "src/app.py",
|
|
})
|
|
assert response.status_code == 200
|
|
|
|
|
|
def test_pending_partial_returns_200(client):
|
|
"""GET /work-orders/queue/pending returns HTML."""
|
|
response = client.get("/work-orders/queue/pending")
|
|
assert response.status_code == 200
|
|
|
|
|
|
def test_active_partial_returns_200(client):
|
|
"""GET /work-orders/queue/active returns HTML."""
|
|
response = client.get("/work-orders/queue/active")
|
|
assert response.status_code == 200
|
|
|
|
|
|
def test_submit_and_list_roundtrip(client):
|
|
"""Submitting a work order makes it appear in the pending section."""
|
|
client.post("/work-orders/submit", data={
|
|
"title": "Roundtrip WO",
|
|
"priority": "medium",
|
|
"category": "suggestion",
|
|
"submitter": "test",
|
|
})
|
|
response = client.get("/work-orders/queue/pending")
|
|
assert "Roundtrip WO" in response.text
|
|
|
|
|
|
def test_approve_work_order(client):
|
|
"""POST /work-orders/{id}/approve changes status."""
|
|
# Submit one first
|
|
client.post("/work-orders/submit", data={
|
|
"title": "To approve",
|
|
"priority": "medium",
|
|
"category": "suggestion",
|
|
"submitter": "test",
|
|
})
|
|
# Get ID from pending
|
|
pending = client.get("/work-orders/queue/pending")
|
|
import re
|
|
match = re.search(r'id="wo-([^"]+)"', pending.text)
|
|
if match:
|
|
wo_id = match.group(1)
|
|
response = client.post(f"/work-orders/{wo_id}/approve")
|
|
assert response.status_code == 200
|
|
assert "APPROVED" in response.text.upper() or "EXECUTE" in response.text.upper()
|