1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-21 14:19:41 +02:00
mealie/tests/integration_tests/admin_tests/test_admin_about.py

53 lines
1.8 KiB
Python
Raw Normal View History

Refactor/conver to controllers (#923) * add dependency injection for get_repositories * convert events api to controller * update generic typing * add abstract controllers * update test naming * migrate admin services to controllers * add additional admin route tests * remove print * add public shared dependencies * add types * fix typo * add static variables for recipe json keys * add coverage gutters config * update controller routers * add generic success response * add category/tag/tool tests * add token refresh test * add coverage utilities * covert comments to controller * add todo * add helper properties * delete old service * update test notes * add unit test for pretty_stats * remove dead code from post_webhooks * update group routes to use controllers * add additional group test coverage * abstract common permission checks * convert ingredient parser to controller * update recipe crud to use controller * remove dead-code * add class lifespan tracker for debugging * convert bulk export to controller * migrate tools router to controller * update recipe share to controller * move customer router to _base * ignore prints in flake8 * convert units and foods to new controllers * migrate user routes to controllers * centralize error handling * fix invalid ref * reorder fields * update routers to share common handling * update tests * remove prints * fix cookbooks delete * fix cookbook get * add controller for mealplanner * cover report routes to controller * remove __future__ imports * remove dead code * remove all base_http children and remove dead code
2022-01-13 13:06:52 -09:00
from fastapi.testclient import TestClient
from mealie.core.config import get_app_settings
from mealie.core.settings.static import APP_VERSION
from tests.utils.fixture_schemas import TestUser
class Routes:
base = "/api/admin/about"
statistics = f"{base}/statistics"
check = f"{base}/check"
def test_admin_about_get_app_info(api_client: TestClient, admin_user: TestUser):
response = api_client.get(Routes.base, headers=admin_user.token)
as_dict = response.json()
settings = get_app_settings()
assert as_dict["version"] == APP_VERSION
assert as_dict["demoStatus"] == settings.IS_DEMO
assert as_dict["apiPort"] == settings.API_PORT
assert as_dict["apiDocs"] == settings.API_DOCS
assert as_dict["dbType"] == settings.DB_ENGINE
# assert as_dict["dbUrl"] == settings.DB_URL_PUBLIC
assert as_dict["defaultGroup"] == settings.DEFAULT_GROUP
def test_admin_about_get_app_statistics(api_client: TestClient, admin_user: TestUser):
response = api_client.get(Routes.statistics, headers=admin_user.token)
as_dict = response.json()
# Smoke Test - Test the endpoint returns something that's a number
Refactor/conver to controllers (#923) * add dependency injection for get_repositories * convert events api to controller * update generic typing * add abstract controllers * update test naming * migrate admin services to controllers * add additional admin route tests * remove print * add public shared dependencies * add types * fix typo * add static variables for recipe json keys * add coverage gutters config * update controller routers * add generic success response * add category/tag/tool tests * add token refresh test * add coverage utilities * covert comments to controller * add todo * add helper properties * delete old service * update test notes * add unit test for pretty_stats * remove dead code from post_webhooks * update group routes to use controllers * add additional group test coverage * abstract common permission checks * convert ingredient parser to controller * update recipe crud to use controller * remove dead-code * add class lifespan tracker for debugging * convert bulk export to controller * migrate tools router to controller * update recipe share to controller * move customer router to _base * ignore prints in flake8 * convert units and foods to new controllers * migrate user routes to controllers * centralize error handling * fix invalid ref * reorder fields * update routers to share common handling * update tests * remove prints * fix cookbooks delete * fix cookbook get * add controller for mealplanner * cover report routes to controller * remove __future__ imports * remove dead code * remove all base_http children and remove dead code
2022-01-13 13:06:52 -09:00
assert as_dict["totalRecipes"] >= 0
assert as_dict["uncategorizedRecipes"] >= 0
assert as_dict["untaggedRecipes"] >= 0
assert as_dict["totalUsers"] >= 0
assert as_dict["totalGroups"] >= 0
def test_admin_about_check_app_config(api_client: TestClient, admin_user: TestUser):
response = api_client.get(Routes.check, headers=admin_user.token)
as_dict = response.json()
# Smoke Test - Test the endpoint returns something that's a the expected shape
Refactor/conver to controllers (#923) * add dependency injection for get_repositories * convert events api to controller * update generic typing * add abstract controllers * update test naming * migrate admin services to controllers * add additional admin route tests * remove print * add public shared dependencies * add types * fix typo * add static variables for recipe json keys * add coverage gutters config * update controller routers * add generic success response * add category/tag/tool tests * add token refresh test * add coverage utilities * covert comments to controller * add todo * add helper properties * delete old service * update test notes * add unit test for pretty_stats * remove dead code from post_webhooks * update group routes to use controllers * add additional group test coverage * abstract common permission checks * convert ingredient parser to controller * update recipe crud to use controller * remove dead-code * add class lifespan tracker for debugging * convert bulk export to controller * migrate tools router to controller * update recipe share to controller * move customer router to _base * ignore prints in flake8 * convert units and foods to new controllers * migrate user routes to controllers * centralize error handling * fix invalid ref * reorder fields * update routers to share common handling * update tests * remove prints * fix cookbooks delete * fix cookbook get * add controller for mealplanner * cover report routes to controller * remove __future__ imports * remove dead code * remove all base_http children and remove dead code
2022-01-13 13:06:52 -09:00
assert as_dict["emailReady"] in [True, False]
assert as_dict["ldapReady"] in [True, False]
assert as_dict["baseUrlSet"] in [True, False]
assert as_dict["isUpToDate"] in [True, False]