lint and format

This commit is contained in:
Jakub Miazek 2023-07-24 19:29:31 +02:00
parent 2fb3035709
commit f77ab40352
4 changed files with 8 additions and 10 deletions

View File

@ -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)

View File

@ -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
# TODO: baerer token test
# TODO: > get token > test endpoint auth with token > expire token on redis > test endpoint auth with token

View File

@ -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"])

View File

@ -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