Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,20 @@ async def test_health(client):
assert r.status_code == 200


async def test_empty_document_text_is_rejected(client):
r = await client.post(
"/documents",
json={
"id": "empty-text",
"title": "Empty Text",
"source": "wiki",
"acl": ["engineering"],
"text": "",
},
)
assert r.status_code == 422


async def test_ask_requires_identity(client):
r = await client.post("/ask", json={"question": "what is the bonus"})
assert r.status_code == 422, "no user header should be rejected, not defaulted"
Expand Down
6 changes: 3 additions & 3 deletions vaultrag/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ class AskResponse(BaseModel):


class DocIn(BaseModel):
id: str
title: str
id: str = Field(min_length=1)
title: str = Field(min_length=1)
source: str
text: str
text: str = Field(min_length=1)
acl: list[str] = Field(description="user ids and/or group names. Empty means nobody can see it.")
owner: str | None = None
department: str | None = None
Expand Down
Loading