diff --git a/app/services/auth.py b/app/services/auth.py index ee9bc79..2a2ad87 100644 --- a/app/services/auth.py +++ b/app/services/auth.py @@ -20,7 +20,7 @@ async def verify_jwt(request: Request, token: str) -> bool: class AuthBearer(HTTPBearer): def __init__(self, auto_error: bool = True): - super(AuthBearer, self).__init__(auto_error=auto_error) + super().__init__(auto_error=auto_error) async def __call__(self, request: Request): credentials: HTTPAuthorizationCredentials = await super(AuthBearer, self).__call__(request) diff --git a/tests/api/test_auth.py b/tests/api/test_auth.py index d3b003d..e227335 100644 --- a/tests/api/test_auth.py +++ b/tests/api/test_auth.py @@ -5,14 +5,10 @@ import jwt pytestmark = pytest.mark.anyio + # TODO: parametrize test with diff urls async def test_add_user(client: AsyncClient): - payload = { - "email": "rancher@grassroots.com", - "first_name": "Joe", - "last_name": "Garcia", - "password": "s1lly" - } + payload = {"email": "rancher@grassroots.com", "first_name": "Joe", "last_name": "Garcia", "password": "s1lly"} response = await client.post("/user/", json=payload) assert response.status_code == status.HTTP_201_CREATED claimset = jwt.decode(response.json()["access_token"], options={"verify_signature": False}) @@ -32,4 +28,5 @@ async def test_get_token(client: AsyncClient): assert claimset["platform"] == "python-httpx/0.24.1" -# TODO: baerer token test > get token > test endpoint auth with token > expire token on redis > test endpoint auth with token \ No newline at end of file +# TODO: baerer token test +# TODO: > get token > test endpoint auth with token > expire token on redis > test endpoint auth with token diff --git a/tests/api/test_health.py b/tests/api/test_health.py index 2b623b7..cd8df4f 100644 --- a/tests/api/test_health.py +++ b/tests/api/test_health.py @@ -4,8 +4,9 @@ from httpx import AsyncClient pytestmark = pytest.mark.anyio + async def test_redis_health(client: AsyncClient): - response = await client.get(f"/public/health/redis") + response = await client.get("/public/health/redis") assert response.status_code == status.HTTP_200_OK # assert payload["name"] == response.json()["name"] # assert UUID(response.json()["id"]) diff --git a/tests/conftest.py b/tests/conftest.py index a8b4bca..97e6f0e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -11,7 +11,7 @@ from app.redis import get_redis scope="session", params=[ pytest.param(("asyncio", {"use_uvloop": True}), id="asyncio+uvloop"), - ] + ], ) def anyio_backend(request): return request.param