Compare commits

...

2 Commits

Author SHA1 Message Date
Dev Agent
95072e000f fix: tests — add setup_db fixture for init_db in test env 2026-05-19 15:58:37 +03:00
Dev Agent
8859c38a2a chore: add .gitignore, remove .env from tracking 2026-05-19 15:57:13 +03:00
18 changed files with 36 additions and 12 deletions

10
.env
View File

@@ -1,10 +0,0 @@
ORCH_PLANE_API_URL=http://plane-app-api-1:8000
ORCH_PLANE_API_TOKEN=
ORCH_PLANE_WORKSPACE_SLUG=
ORCH_PLANE_WEBHOOK_SECRET=
ORCH_GITEA_URL=http://localhost:3000
ORCH_GITEA_TOKEN=c81227b0dee2217f9ab3d28c3642a4578a1b9772
ORCH_GITEA_WEBHOOK_SECRET=
ORCH_CLAUDE_BIN=/usr/bin/claude
ORCH_REPOS_DIR=/home/slin/repos
ORCH_DB_PATH=/app/data/orchestrator.db

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.env

1
.venv/bin/python Symbolic link
View File

@@ -0,0 +1 @@
python3

1
.venv/bin/python3 Symbolic link
View File

@@ -0,0 +1 @@
/usr/bin/python3

1
.venv/bin/python3.10 Symbolic link
View File

@@ -0,0 +1 @@
python3

1
.venv/lib64 Symbolic link
View File

@@ -0,0 +1 @@
lib

3
.venv/pyvenv.cfg Normal file
View File

@@ -0,0 +1,3 @@
home = /usr/bin
include-system-site-packages = false
version = 3.10.12

BIN
data/orchestrator.db Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -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)