This repository has been archived on 2026-02-23. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
adk-firestore/tests/conftest.py
2026-02-21 18:19:16 +00:00

36 lines
765 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 adk_firestore_sessionmanager import FirestoreSessionService
os.environ.setdefault("FIRESTORE_EMULATOR_HOST", "localhost:8161")
@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]}"