Refactor API endpoints to async

This commit is contained in:
thePR0M3TH3AN committed 2025-08-05 20:03:56 -04:00
1 parent 726a8f7aa4
commit dc7673c7e0
6 files changed
+185 -119

No files matched your search

+4 -3
View File
@@ -1,13 +1,14 @@
from test_api import client
import pytest
def test_profile_stats_endpoint(client):
@pytest.mark.anyio
async def test_profile_stats_endpoint(client):
cl, token = client
stats = {"total_entries": 1}
# monkeypatch set _pm.get_profile_stats after client fixture started
import seedpass.api as api
api.app.state.pm.get_profile_stats = lambda: stats
res = cl.get("/api/v1/stats", headers={"Authorization": f"Bearer {token}"})
res = await cl.get("/api/v1/stats", headers={"Authorization": f"Bearer {token}"})
assert res.status_code == 200
assert res.json() == stats