|
3 | 3 | These tests verify the behavior of the Elasticsearch API without actual database connections. |
4 | 4 | All external services and dependencies are mocked to isolate the tests. |
5 | 5 | """ |
6 | | - |
7 | | -from fastapi.testclient import TestClient |
8 | | -from fastapi import HTTPException, FastAPI |
9 | | -from backend.apps.elasticsearch_app import router |
10 | | -from nexent.vector_database.elasticsearch_core import ElasticSearchCore |
11 | 6 | import os |
12 | 7 | import sys |
13 | | -import pytest |
14 | | -from unittest.mock import patch, MagicMock, AsyncMock, ANY |
15 | | -from typing import List, Optional, Union, Dict, Any |
16 | | -from pydantic import BaseModel |
17 | 8 |
|
18 | 9 | # Dynamically determine the backend path and add it to sys.path |
19 | 10 | current_dir = os.path.dirname(os.path.abspath(__file__)) |
20 | 11 | backend_dir = os.path.abspath(os.path.join(current_dir, "../../../backend")) |
21 | 12 | sys.path.insert(0, backend_dir) |
22 | 13 |
|
23 | | -# Define necessary Pydantic models before importing any backend code |
| 14 | +from fastapi.testclient import TestClient |
| 15 | +from fastapi import FastAPI |
| 16 | +from backend.apps.elasticsearch_app import router |
| 17 | +from nexent.vector_database.elasticsearch_core import ElasticSearchCore |
| 18 | + |
| 19 | +import pytest |
| 20 | +from unittest.mock import patch, MagicMock, ANY |
| 21 | +from typing import List |
| 22 | +from pydantic import BaseModel |
24 | 23 |
|
25 | 24 |
|
26 | 25 | class SearchRequest(BaseModel): |
|
0 commit comments