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

feat: Upgrade to Pydantic V2 (#3134)
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Docker Nightly Production / Build Tagged Release (push) Blocked by required conditions
Docker Nightly Production / Notify Discord (push) Blocked by required conditions
Docker Nightly Production / Backend Server Tests (push) Waiting to run
Docker Nightly Production / Frontend and End-to-End Tests (push) Waiting to run

* bumped pydantic
This commit is contained in:
Michael Genson 2024-02-11 10:47:37 -06:00 committed by GitHub
parent 248459671e
commit 7a107584c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
129 changed files with 1138 additions and 833 deletions

View file

@ -2,6 +2,7 @@ import random
import string
from fastapi.testclient import TestClient
from mealie.core.config import get_app_settings
from tests.utils import api_routes
from tests.utils.factories import user_registration_factory
@ -14,21 +15,21 @@ def test_register_user(api_client: TestClient, monkeypatch):
# signup disabled but valid request
monkeypatch.setenv("ALLOW_SIGNUP", "False")
get_app_settings.cache_clear()
response = api_client.post(api_routes.users_register, json=registration.dict(by_alias=True))
response = api_client.post(api_routes.users_register, json=registration.model_dump(by_alias=True))
assert response.status_code == 403
# signup disabled, request includes non valid group token
registration.group_token = "".join(random.choice(string.ascii_lowercase + string.digits) for _ in range(10)).strip()
response = api_client.post(api_routes.users_register, json=registration.dict(by_alias=True))
response = api_client.post(api_routes.users_register, json=registration.model_dump(by_alias=True))
assert response.status_code == 400
# signup enabled but contains non valid group token
monkeypatch.setenv("ALLOW_SIGNUP", "True")
get_app_settings.cache_clear()
response = api_client.post(api_routes.users_register, json=registration.dict(by_alias=True))
response = api_client.post(api_routes.users_register, json=registration.model_dump(by_alias=True))
assert response.status_code == 400
# signup enabled and valid request
registration.group_token = None
response = api_client.post(api_routes.users_register, json=registration.dict(by_alias=True))
response = api_client.post(api_routes.users_register, json=registration.model_dump(by_alias=True))
assert response.status_code == 201