test: fix test warning (#2725)

This commit is contained in:
dni ⚡ 2024-10-01 11:07:13 +02:00 committed by GitHub
parent a4c000d7dc
commit a28e334c5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10,7 +10,7 @@ uvloop.install()
import pytest
import pytest_asyncio
from fastapi.testclient import TestClient
from httpx import AsyncClient
from httpx import ASGITransport, AsyncClient
from lnbits.app import create_app
from lnbits.core.crud import (
@ -56,14 +56,16 @@ async def app():
@pytest_asyncio.fixture(scope="session")
async def client(app):
url = f"http://{settings.host}:{settings.port}"
async with AsyncClient(app=app, base_url=url) as client:
async with AsyncClient(transport=ASGITransport(app=app), base_url=url) as client:
yield client
# function scope
@pytest_asyncio.fixture(scope="function")
async def http_client(app):
url = f"http://{settings.host}:{settings.port}"
async with AsyncClient(app=app, base_url=url) as client:
async with AsyncClient(transport=ASGITransport(app=app), base_url=url) as client:
yield client