mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-14 10:17:55 +00:00
Pg 4 (#2390)
* feat: postgres tests * feat: mongo cutoff * feat: mongo cutoff * feat: adjust docs and compose files * fix: mini code mongo removals * fix: tests and k8s mongo stuff * feat: test fixes * fix: ruff * fix: vale * Potential fix for pull request finding 'CodeQL / Clear-text logging of sensitive information' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * fix: mini suggestions * vale lint fix 2 * fix: codeql columns thing * fix: test mongo * fix: tests coverage * feat: better tests 4 * feat: more tests * feat: decent coverage * fix: ruff fixes * fix: remove mongo mock * feat: enhance workflow engine and API routes; add document retrieval and source handling * feat: e2e tests * fix: mcp, mongo and more * fix: mini codeql warning * fix: agent chunk view * fix: mini issues * fix: more pg fixes * feat: postgres prep on start * feat: qa tests * fix: mini improvements * fix: tests --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Co-authored-by: Siddhant Rai <siddhant.rai.5686@gmail.com>
This commit is contained in:
312 files changed
+763725
-25159
No files matched your search
+22
-4
@@ -1,7 +1,8 @@
|
||||
"""API-specific test fixtures."""
|
||||
|
||||
import uuid
|
||||
|
||||
import pytest
|
||||
from bson import ObjectId
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -27,7 +28,7 @@ def mock_request_token(monkeypatch, decoded_token):
|
||||
@pytest.fixture
|
||||
def sample_conversation():
|
||||
return {
|
||||
"_id": ObjectId(),
|
||||
"_id": uuid.uuid4().hex[:24],
|
||||
"user": "test_user",
|
||||
"name": "Test Conversation",
|
||||
"queries": [
|
||||
@@ -43,7 +44,7 @@ def sample_conversation():
|
||||
@pytest.fixture
|
||||
def sample_prompt():
|
||||
return {
|
||||
"_id": ObjectId(),
|
||||
"_id": uuid.uuid4().hex[:24],
|
||||
"user": "test_user",
|
||||
"name": "Helpful Assistant",
|
||||
"content": "You are a helpful assistant that provides clear and concise answers.",
|
||||
@@ -54,7 +55,7 @@ def sample_prompt():
|
||||
@pytest.fixture
|
||||
def sample_agent():
|
||||
return {
|
||||
"_id": ObjectId(),
|
||||
"_id": uuid.uuid4().hex[:24],
|
||||
"user": "test_user",
|
||||
"name": "Test Agent",
|
||||
"type": "classic",
|
||||
@@ -86,3 +87,20 @@ def flask_app():
|
||||
|
||||
app = Flask(__name__)
|
||||
return app
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_mongo_db():
|
||||
"""Compatibility shim for tests written against the old mongomock fixture.
|
||||
|
||||
The canonical ``mock_mongo_db`` fixture was removed when the answer pipeline
|
||||
moved from Mongo to Postgres (see tests/conftest.py docstring). Most API
|
||||
tests that still request it only do so as a historical gate: they patch
|
||||
specific mongo collections (``agents_collection``, etc.) via
|
||||
``unittest.mock.patch`` inside the test body and never touch the fixture's
|
||||
return value. Yielding ``None`` keeps those tests runnable without
|
||||
reintroducing mongomock. Tests that actually need a working Mongo client
|
||||
(e.g. ones that call ``MongoDB.get_client()``) will still fail; skip or
|
||||
rewrite those per-case rather than reviving a global fake.
|
||||
"""
|
||||
yield None
|
||||
Reference in new issue
Block a user