1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-25 08:09:41 +02:00
mealie/tests/integration_tests/user_group_tests/test_group_registration.py

25 lines
697 B
Python
Raw Normal View History

from fastapi.testclient import TestClient
from tests.utils.factories import user_registration_factory
class Routes:
base = "/api/users/register"
auth_token = "/api/auth/token"
def test_user_registration_new_group(api_client: TestClient):
registration = user_registration_factory()
response = api_client.post(Routes.base, json=registration.dict(by_alias=True))
assert response.status_code == 201
# Login
form_data = {"username": registration.email, "password": registration.password}
response = api_client.post(Routes.auth_token, form_data)
assert response.status_code == 200
token = response.json().get("access_token")
assert token is not None