Protect private API routes and scope agent data
This commit is contained in:
@@ -9,10 +9,9 @@ if "SOVEREIGNAI_DATA_DIR" not in os.environ:
|
||||
_TEST_DATA_DIR = tempfile.TemporaryDirectory(prefix="sovereignai-mixed-pdf-index-tests-")
|
||||
os.environ["SOVEREIGNAI_DATA_DIR"] = _TEST_DATA_DIR.name
|
||||
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from app import database, knowledge
|
||||
from app.main import app
|
||||
from tests.api_client import authenticated_client
|
||||
from tests.test_pdf_analysis import make_mixed_pdf
|
||||
|
||||
|
||||
@@ -25,7 +24,6 @@ class MixedPdfKnowledgeIntegrationTests(unittest.TestCase):
|
||||
pdf_path = workspace / "mixed.pdf"
|
||||
pdf_path.write_bytes(make_mixed_pdf())
|
||||
database_path = data_dir / "mixed-pdf-knowledge.sqlite3"
|
||||
client = TestClient(app)
|
||||
ocr = {
|
||||
"engine": "easyocr-local-ar-en",
|
||||
"text": "ScannedIndexMarker ArabicPageText",
|
||||
@@ -45,6 +43,7 @@ class MixedPdfKnowledgeIntegrationTests(unittest.TestCase):
|
||||
):
|
||||
database.initialize_database()
|
||||
knowledge.initialize()
|
||||
client = authenticated_client(app)
|
||||
with patch("app.main.recognize_image_text", return_value=ocr):
|
||||
indexed = client.post(
|
||||
"/v1/agent/knowledge/index",
|
||||
|
||||
Reference in New Issue
Block a user