diff --git a/.venv/bin/python b/.venv/bin/python new file mode 120000 index 0000000..b8a0adb --- /dev/null +++ b/.venv/bin/python @@ -0,0 +1 @@ +python3 \ No newline at end of file diff --git a/.venv/bin/python3 b/.venv/bin/python3 new file mode 120000 index 0000000..ae65fda --- /dev/null +++ b/.venv/bin/python3 @@ -0,0 +1 @@ +/usr/bin/python3 \ No newline at end of file diff --git a/.venv/bin/python3.10 b/.venv/bin/python3.10 new file mode 120000 index 0000000..b8a0adb --- /dev/null +++ b/.venv/bin/python3.10 @@ -0,0 +1 @@ +python3 \ No newline at end of file diff --git a/.venv/lib64 b/.venv/lib64 new file mode 120000 index 0000000..7951405 --- /dev/null +++ b/.venv/lib64 @@ -0,0 +1 @@ +lib \ No newline at end of file diff --git a/.venv/pyvenv.cfg b/.venv/pyvenv.cfg new file mode 100644 index 0000000..0537ffc --- /dev/null +++ b/.venv/pyvenv.cfg @@ -0,0 +1,3 @@ +home = /usr/bin +include-system-site-packages = false +version = 3.10.12 diff --git a/data/orchestrator.db b/data/orchestrator.db new file mode 100644 index 0000000..48dd832 Binary files /dev/null and b/data/orchestrator.db differ diff --git a/src/__pycache__/__init__.cpython-312.pyc b/src/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..7112f36 Binary files /dev/null and b/src/__pycache__/__init__.cpython-312.pyc differ diff --git a/src/__pycache__/config.cpython-312.pyc b/src/__pycache__/config.cpython-312.pyc new file mode 100644 index 0000000..f686fd2 Binary files /dev/null and b/src/__pycache__/config.cpython-312.pyc differ diff --git a/src/__pycache__/db.cpython-312.pyc b/src/__pycache__/db.cpython-312.pyc new file mode 100644 index 0000000..b2c3b82 Binary files /dev/null and b/src/__pycache__/db.cpython-312.pyc differ diff --git a/src/__pycache__/main.cpython-312.pyc b/src/__pycache__/main.cpython-312.pyc new file mode 100644 index 0000000..a765d09 Binary files /dev/null and b/src/__pycache__/main.cpython-312.pyc differ diff --git a/src/webhooks/__pycache__/__init__.cpython-312.pyc b/src/webhooks/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..b5efced Binary files /dev/null and b/src/webhooks/__pycache__/__init__.cpython-312.pyc differ diff --git a/src/webhooks/__pycache__/gitea.cpython-312.pyc b/src/webhooks/__pycache__/gitea.cpython-312.pyc new file mode 100644 index 0000000..9d21a1a Binary files /dev/null and b/src/webhooks/__pycache__/gitea.cpython-312.pyc differ diff --git a/src/webhooks/__pycache__/plane.cpython-312.pyc b/src/webhooks/__pycache__/plane.cpython-312.pyc new file mode 100644 index 0000000..f73fb65 Binary files /dev/null and b/src/webhooks/__pycache__/plane.cpython-312.pyc differ diff --git a/tests/__pycache__/__init__.cpython-312.pyc b/tests/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..50e555a Binary files /dev/null and b/tests/__pycache__/__init__.cpython-312.pyc differ diff --git a/tests/__pycache__/test_webhooks.cpython-312-pytest-9.0.3.pyc b/tests/__pycache__/test_webhooks.cpython-312-pytest-9.0.3.pyc new file mode 100644 index 0000000..0e63ef0 Binary files /dev/null and b/tests/__pycache__/test_webhooks.cpython-312-pytest-9.0.3.pyc differ diff --git a/tests/test_webhooks.py b/tests/test_webhooks.py index 0566f6a..99253d8 100644 --- a/tests/test_webhooks.py +++ b/tests/test_webhooks.py @@ -1,12 +1,27 @@ import pytest -from fastapi.testclient import TestClient import os import tempfile # Override DB path before importing app -os.environ["ORCH_DB_PATH"] = os.path.join(tempfile.gettempdir(), "test_orchestrator.db") +_test_db = os.path.join(tempfile.gettempdir(), "test_orchestrator.db") +os.environ["ORCH_DB_PATH"] = _test_db +from fastapi.testclient import TestClient from src.main import app +from src.db import init_db + + +@pytest.fixture(autouse=True) +def setup_db(): + """Ensure DB tables exist before each test.""" + # Remove old test db if exists + if os.path.exists(_test_db): + os.unlink(_test_db) + init_db() + yield + if os.path.exists(_test_db): + os.unlink(_test_db) + client = TestClient(app) @@ -63,3 +78,14 @@ def test_status_endpoint(): resp = client.get("/status") assert resp.status_code == 200 assert "active_tasks" in resp.json() + + +def test_plane_webhook_creates_task(): + """Verify that work_item.created actually inserts a task.""" + client.post("/webhook/plane", json={ + "event": "work_item.created", + "data": {"id": "task-456", "name": "New feature", "project": "proj-2"} + }) + resp = client.get("/status") + tasks = resp.json()["active_tasks"] + assert any(t["plane_id"] == "task-456" for t in tasks)