feat: publish CodexPi contest snapshot
Some checks are pending
Qualité / tests (push) Waiting to run
Some checks are pending
Qualité / tests (push) Waiting to run
This commit is contained in:
24
tests/test_project_activity.py
Normal file
24
tests/test_project_activity.py
Normal file
@@ -0,0 +1,24 @@
|
||||
def test_project_activity_lists_only_running_projects(logged_in):
|
||||
client, app, projects, _, headers = logged_in
|
||||
active_root = projects / "active"
|
||||
idle_root = projects / "idle"
|
||||
active_root.mkdir()
|
||||
idle_root.mkdir()
|
||||
active = client.post("/api/projects", headers=headers, json={"name": "Active", "path": str(active_root)}).json()
|
||||
idle = client.post("/api/projects", headers=headers, json={"name": "Idle", "path": str(idle_root)}).json()
|
||||
conversation = client.post(
|
||||
f"/api/projects/{active['id']}/conversations", headers=headers, json={"title": "Travail en cours"},
|
||||
).json()
|
||||
app.state.db.execute("UPDATE conversations SET status='running' WHERE id=?", (conversation["id"],))
|
||||
|
||||
response = client.get("/api/projects/activity")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {"running_project_ids": [active["id"]]}
|
||||
assert idle["id"] not in response.json()["running_project_ids"]
|
||||
|
||||
|
||||
def test_project_activity_requires_authentication(app_env):
|
||||
client, *_ = app_env
|
||||
|
||||
assert client.get("/api/projects/activity").status_code == 401
|
||||
Reference in New Issue
Block a user