update
This commit is contained in:
@@ -72,3 +72,41 @@ async def test_pruefung_ohne_konfiguration(client, monkeypatch):
|
||||
async def test_unbekanntes_projekt(client):
|
||||
assert (await client.get("/api/projekte/Fremd/features")).status_code == 404
|
||||
assert (await client.post("/api/projekte/Fremd/features", json={"roh": ROH})).status_code == 404
|
||||
assert (await client.get("/api/projekte/Fremd/recherche")).status_code == 404
|
||||
|
||||
|
||||
async def test_recherche_faeden(client, monkeypatch):
|
||||
import agents
|
||||
|
||||
await client.post("/api/projekte", json={"name": "Alpha"})
|
||||
assert (await client.get("/api/projekte/Alpha/recherche")).json()["faeden"] == []
|
||||
|
||||
a = (await client.post("/api/projekte/Alpha/recherche")).json()
|
||||
b = (await client.post("/api/projekte/Alpha/recherche")).json()
|
||||
assert a["id"] != b["id"]
|
||||
|
||||
async def antworte(system, inhalt, kommando=None, ordner=None):
|
||||
return "## Festgelegt\n- **5 GB** je Sendung"
|
||||
|
||||
monkeypatch.setattr(agents, "frage_lokal", antworte)
|
||||
res = await client.post(f"/api/projekte/Alpha/recherche/{a['id']}",
|
||||
json={"text": "Was gilt?"})
|
||||
assert res.json()["titel"] == "Was gilt?"
|
||||
assert len(res.json()["verlauf"]) == 2
|
||||
assert res.json()["verlauf"][-1]["text"] == "## Festgelegt\n- **5 GB** je Sendung"
|
||||
|
||||
# Der zweite Faden bleibt leer — Fäden teilen sich nichts
|
||||
faeden = (await client.get("/api/projekte/Alpha/recherche")).json()["faeden"]
|
||||
assert [len(f["verlauf"]) for f in faeden] == [2, 0]
|
||||
|
||||
assert (await client.delete(f"/api/projekte/Alpha/recherche/{b['id']}")).status_code == 200
|
||||
assert len((await client.get("/api/projekte/Alpha/recherche")).json()["faeden"]) == 1
|
||||
assert (await client.delete(f"/api/projekte/Alpha/recherche/{b['id']}")).status_code == 404
|
||||
|
||||
|
||||
async def test_recherche_leere_frage(client):
|
||||
await client.post("/api/projekte", json={"name": "Alpha"})
|
||||
faden = (await client.post("/api/projekte/Alpha/recherche")).json()
|
||||
res = await client.post(f"/api/projekte/Alpha/recherche/{faden['id']}",
|
||||
json={"text": " "})
|
||||
assert res.status_code == 400
|
||||
|
||||
Reference in New Issue
Block a user