mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-05-31 20:25:14 -04:00
* add recipe scaling notes * test theme rename * fix coverage call to use poetry * remove print * remove async * consolidate test case data * fix mealplan tests * remove redundant else Co-authored-by: hay-kot <hay-kot@pm.me>
32 lines
948 B
Python
32 lines
948 B
Python
import json
|
|
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
from mealie.schema.settings import SiteSettings
|
|
from tests.app_routes import AppRoutes
|
|
|
|
|
|
@pytest.fixture(scope="function")
|
|
def default_settings():
|
|
return SiteSettings().dict(by_alias=True)
|
|
|
|
|
|
def test_default_settings(api_client: TestClient, api_routes: AppRoutes, default_settings):
|
|
response = api_client.get(api_routes.site_settings)
|
|
|
|
assert response.status_code == 200
|
|
|
|
assert json.loads(response.content) == default_settings
|
|
|
|
|
|
def test_update_settings(api_client: TestClient, api_routes: AppRoutes, default_settings, token):
|
|
default_settings["language"] = "fr"
|
|
default_settings["showRecent"] = False
|
|
|
|
response = api_client.put(api_routes.site_settings, json=default_settings, headers=token)
|
|
|
|
assert response.status_code == 200
|
|
|
|
response = api_client.get(api_routes.site_settings)
|
|
assert json.loads(response.content) == default_settings
|