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