mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-08-26 16:40:40 +03:00
lint and format
This commit is contained in:
parent
2fb3035709
commit
f77ab40352
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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"])
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user