37 lines
930 B
Python
37 lines
930 B
Python
"""Pytest configuration and shared fixtures."""
|
|
|
|
import os
|
|
from unittest.mock import MagicMock
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def mock_env_vars(monkeypatch):
|
|
"""Set required environment variables for testing."""
|
|
test_env = {
|
|
"PROJECT_ID": "test-project",
|
|
"LOCATION": "us-central1",
|
|
"BUCKET": "test-bucket",
|
|
"INDEX_NAME": "test-index",
|
|
"DEPLOYED_INDEX_ID": "test-deployed-index",
|
|
"ENDPOINT_NAME": "projects/test/locations/us-central1/indexEndpoints/test",
|
|
"ENDPOINT_DOMAIN": "test.us-central1-aiplatform.googleapis.com",
|
|
}
|
|
for key, value in test_env.items():
|
|
monkeypatch.setenv(key, value)
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_gcs_storage():
|
|
"""Mock Google Cloud Storage client."""
|
|
mock = MagicMock()
|
|
return mock
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_vector_search():
|
|
"""Mock vector search client."""
|
|
mock = MagicMock()
|
|
return mock
|