mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-11-06 04:42:35 +00:00
Refactor API endpoints to async
This commit is contained in:
1 parent
726a8f7aa4
commit
dc7673c7e0
6 files changed
+185
-119
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user