36 lines
763 B
Python
36 lines
763 B
Python
"""Shared fixtures for Firestore session service tests."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import uuid
|
|
|
|
import pytest
|
|
import pytest_asyncio
|
|
from google.cloud.firestore_v1.async_client import AsyncClient
|
|
|
|
from va_agent.session.firestore import FirestoreSessionService
|
|
|
|
os.environ.setdefault("FIRESTORE_EMULATOR_HOST", "localhost:8153")
|
|
|
|
|
|
@pytest_asyncio.fixture
|
|
async def db():
|
|
return AsyncClient(project="test-project")
|
|
|
|
|
|
@pytest_asyncio.fixture
|
|
async def service(db: AsyncClient):
|
|
prefix = f"test_{uuid.uuid4().hex[:8]}"
|
|
return FirestoreSessionService(db=db, collection_prefix=prefix)
|
|
|
|
|
|
@pytest.fixture
|
|
def app_name():
|
|
return f"app_{uuid.uuid4().hex[:8]}"
|
|
|
|
|
|
@pytest.fixture
|
|
def user_id():
|
|
return f"user_{uuid.uuid4().hex[:8]}"
|