47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
import pytest
|
|
|
|
DESIGN_DIR = "/workspace/arch-design-agent-skill-dashboard/design"
|
|
|
|
|
|
@pytest.fixture
|
|
def project_id(client):
|
|
r = client.post("/api/projects", json={"name": "test", "design_dir": DESIGN_DIR})
|
|
return r.json()["id"]
|
|
|
|
|
|
def test_evaluate_progress(client, project_id):
|
|
# Need to scan first
|
|
client.post(f"/api/projects/{project_id}/scan")
|
|
r = client.post(f"/api/projects/{project_id}/impl-progress")
|
|
assert r.status_code == 200
|
|
data = r.json()
|
|
assert isinstance(data, list)
|
|
assert len(data) > 0
|
|
assert "module_id" in data[0]
|
|
assert "percentage" in data[0]
|
|
|
|
|
|
def test_get_progress_not_evaluated(client, project_id):
|
|
r = client.get(f"/api/projects/{project_id}/impl-progress")
|
|
assert r.status_code == 404
|
|
|
|
|
|
def test_get_progress_after_evaluate(client, project_id):
|
|
client.post(f"/api/projects/{project_id}/scan")
|
|
client.post(f"/api/projects/{project_id}/impl-progress")
|
|
r = client.get(f"/api/projects/{project_id}/impl-progress")
|
|
assert r.status_code == 200
|
|
assert isinstance(r.json(), list)
|
|
|
|
|
|
def test_set_manual_progress(client, project_id):
|
|
client.post(f"/api/projects/{project_id}/scan")
|
|
client.post(f"/api/projects/{project_id}/impl-progress")
|
|
r = client.put(
|
|
f"/api/projects/{project_id}/impl-progress/MOD-PROJECT",
|
|
json={"percentage": 80.0},
|
|
)
|
|
assert r.status_code == 200
|
|
assert r.json()["percentage"] == 80.0
|
|
assert r.json()["source"] == "manual"
|