1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-23 07:09:41 +02:00
mealie/tests/utils/user_login.py
Hayden 14cc541f7a
fix #967 and test error to catch (#979)
* fix #967 and test error to catch

* add admin tests
2022-02-13 18:33:25 -09:00

12 lines
371 B
Python

import json
from fastapi.testclient import TestClient
from .app_routes import AppRoutes
def login(form_data, api_client: TestClient, api_routes: AppRoutes):
response = api_client.post(api_routes.auth_token, form_data)
assert response.status_code == 200
token = json.loads(response.text).get("access_token")
return {"Authorization": f"Bearer {token}"}