Files
RAG/backend/tests/unit/test_export_openapi.py
YoVinchen ecdb10c37a
Some checks failed
verify / verify (push) Has been cancelled
Make the governed RAG evidence path executable end to end
Separate local parsing from model indexing, bind review decisions to immutable manifests, persist vectors behind active profiles, and expose retrieval, chat, evaluation, and document workflows through the React workbench.

Constraint: Live Bailian authentication currently fails for all three configured capabilities

Rejected: Direct upload-to-embedding flow | bypasses local review and manifest binding

Confidence: high

Scope-risk: broad

Directive: Keep private-data deployment blocked until authentication, RBAC, and separate database roles land

Tested: make verify; fresh and replay Docker document smoke; worker recovery smoke; frozen synthetic evaluation; migration 0003-0004 roundtrip

Not-tested: Successful live Bailian calls, OCR, real multi-user authorization
2026-07-13 05:58:11 +08:00

35 lines
1.2 KiB
Python

from __future__ import annotations
import pytest
from app.tools.export_openapi import export_schema
def test_openapi_export_is_offline_and_contains_product_contracts(
monkeypatch: pytest.MonkeyPatch,
) -> None:
def forbidden(*_args: object, **_kwargs: object) -> None:
raise AssertionError("OpenAPI export must not open a database or read a secret")
monkeypatch.setattr("psycopg.connect", forbidden)
monkeypatch.setattr("app.core.secrets.read_secret_file", forbidden)
schema = export_schema()
paths = schema["paths"]
assert "/api/v1/retrieval/search" in paths
assert "/api/v1/chat/completions" in paths
assert "/api/v1/document-uploads" in paths
assert "/api/v1/document-uploads/{upload_id}/content" in paths
assert "/api/v1/document-uploads/{upload_id}/complete" in paths
assert "/api/v1/documents" in paths
assert "/api/v1/documents/{document_id}/review-bundle" in paths
assert "/api/v1/documents/{document_id}/review-decisions" in paths
assert (
paths["/api/v1/documents/{document_id}/review-decisions"]["post"]["operationId"]
== "createDocumentReviewDecision"
)
assert paths["/api/v1/chat/completions"]["post"]["operationId"] == (
"streamGroundedChatCompletion"
)