Scope workspace roots per account

This commit is contained in:
Hamza Ayed
2026-10-03 01:44:00 +03:00
parent 1b56f70aa6
commit 4345e43e29
10 changed files with 250 additions and 54 deletions
+14 -11
View File
@@ -243,17 +243,20 @@ class PdfAnalysisTests(unittest.TestCase):
with tempfile.TemporaryDirectory() as directory:
root = Path(directory)
(root / "meetup.pdf").write_bytes(make_pdf("Community Meetup Amman"))
listed = self.client.post(
"/v1/agent/workspace/files", json={"workspace_path": str(root)}
)
indexed = self.client.post(
"/v1/agent/knowledge/index",
json={"workspace_path": str(root), "files": ["meetup.pdf"]},
)
searched = self.client.post(
"/v1/agent/knowledge/search",
json={"workspace_path": str(root), "task": "Community Meetup"},
)
with patch.dict(
os.environ, {"SOVEREIGNAI_ALLOWED_WORKSPACES": str(root)}
):
listed = self.client.post(
"/v1/agent/workspace/files", json={"workspace_path": str(root)}
)
indexed = self.client.post(
"/v1/agent/knowledge/index",
json={"workspace_path": str(root), "files": ["meetup.pdf"]},
)
searched = self.client.post(
"/v1/agent/knowledge/search",
json={"workspace_path": str(root), "task": "Community Meetup"},
)
self.assertEqual(listed.status_code, 200, listed.text)
self.assertIn("meetup.pdf", listed.json()["files"])