aboutsummaryrefslogtreecommitdiff
path: root/tests/fixtures/http.py
diff options
context:
space:
mode:
authorMax Nanis2026-02-27 17:31:56 -0500
committerMax Nanis2026-02-27 17:31:56 -0500
commit0cee6feeb002f91d6c894cee16a564d86ddaaa51 (patch)
treeded10a74370e45c30855e02401a76289550de288 /tests/fixtures/http.py
parent81c377d8a629eaf09172f96876c9877a6f400d54 (diff)
downloadamt-jb-0cee6feeb002f91d6c894cee16a564d86ddaaa51.tar.gz
amt-jb-0cee6feeb002f91d6c894cee16a564d86ddaaa51.zip
AsyncGenerator type checking and model imports to http fixtures.
Diffstat (limited to 'tests/fixtures/http.py')
-rw-r--r--tests/fixtures/http.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/fixtures/http.py b/tests/fixtures/http.py
index 4f11fde..5f50580 100644
--- a/tests/fixtures/http.py
+++ b/tests/fixtures/http.py
@@ -4,7 +4,7 @@ import pytest
import requests_mock
from asgi_lifespan import LifespanManager
from httpx import AsyncClient, ASGITransport
-from typing import Dict, Any
+from typing import Dict, Any, AsyncGenerator
from jb.main import app
import json
@@ -12,6 +12,8 @@ import json
from httpx import AsyncClient
import secrets
+from jb.models.hit import Hit
+from jb.models.assignment import AssignmentStub
from jb.config import JB_EVENTS_STREAM, settings
from tests import generate_amt_id
@@ -22,7 +24,7 @@ def anyio_backend():
@pytest.fixture(scope="session")
-async def httpxclient():
+async def httpxclient() -> AsyncGenerator[AsyncClient, None]:
# limiter.enabled = True
# limiter.reset()
app.testing = True
@@ -46,11 +48,11 @@ def no_limit():
@pytest.fixture()
-def httpxclient_ip(httpxclient):
+def httpxclient_ip(httpxclient: AsyncClient):
"""Fixture to execute asserts before and after a test is run"""
- httpxclient._transport = httpx.ASGITransport(app=app, client=("1.2.3.4", 8001))
+ httpxclient._transport = httpx.ASGITransport(app=app, client=("1.2.3.4", 8001)) # type: ignore[attr-defined]
yield httpxclient # this is where the testing happens
- httpxclient._transport = httpx.ASGITransport(app=app)
+ httpxclient._transport = httpx.ASGITransport(app=app) # type: ignore[attr-defined]
@pytest.fixture