initial commit after automated creating
This commit is contained in:
commit
1cf124a5a3
48 changed files with 12041 additions and 0 deletions
31
tests/conftest.py
Normal file
31
tests/conftest.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
"""Shared pytest fixtures for the agravity-client test suite."""
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
import httpx
|
||||
|
||||
from agravity_client.client import AgravityClient
|
||||
from agravity_client.config import AgravityConfig
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def config() -> AgravityConfig:
|
||||
"""Return a test AgravityConfig with a dummy API key."""
|
||||
return AgravityConfig(
|
||||
api_key="test-api-key",
|
||||
base_url="https://api.example.local/api",
|
||||
)
|
||||
|
||||
|
||||
@pytest_asyncio.fixture
|
||||
async def client(config: AgravityConfig) -> AgravityClient:
|
||||
"""Return an AgravityClient backed by a real (but not-yet-connected) transport.
|
||||
|
||||
Tests that need to mock HTTP responses should use ``pytest-httpx``'s
|
||||
``httpx_mock`` fixture and pass a transport via::
|
||||
|
||||
client._http = httpx.AsyncClient(transport=httpx_mock.get_async_handler())
|
||||
"""
|
||||
async with AgravityClient(config) as c:
|
||||
yield c
|
||||
Loading…
Add table
Add a link
Reference in a new issue