mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-02 20:15:24 +02:00
feat(backend): ✨ refactor/fix group management for admins (#838)
* fix(frontend): 🐛 update dialog implementation to simplify state management * test(backend): ✅ refactor test fixtures + admin group tests * chore(backend): 🔨 add launcher.json for python debugging (tests) * fix typing * feat(backend): ✨ refactor/fix group management for admins * feat(frontend): ✨ add/fix admin group management * add LDAP checker Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
parent
0db8a58963
commit
791aa8c610
52 changed files with 881 additions and 331 deletions
41
tests/fixtures/fixture_admin.py
vendored
Normal file
41
tests/fixtures/fixture_admin.py
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
import requests
|
||||
from pytest import fixture
|
||||
from starlette.testclient import TestClient
|
||||
|
||||
from mealie.core.config import get_app_settings
|
||||
from tests import utils
|
||||
|
||||
|
||||
@fixture(scope="session")
|
||||
def admin_token(api_client: requests, api_routes: utils.AppRoutes):
|
||||
settings = get_app_settings()
|
||||
|
||||
form_data = {"username": "changeme@email.com", "password": settings.DEFAULT_PASSWORD}
|
||||
return utils.login(form_data, api_client, api_routes)
|
||||
|
||||
|
||||
@fixture(scope="session")
|
||||
def admin_user(api_client: TestClient, api_routes: utils.AppRoutes):
|
||||
settings = get_app_settings()
|
||||
|
||||
form_data = {"username": "changeme@email.com", "password": settings.DEFAULT_PASSWORD}
|
||||
|
||||
token = utils.login(form_data, api_client, api_routes)
|
||||
|
||||
user_data = api_client.get(api_routes.users_self, headers=token).json()
|
||||
assert token is not None
|
||||
|
||||
assert user_data.get("admin") is True
|
||||
assert user_data.get("groupId") is not None
|
||||
assert user_data.get("id") is not None
|
||||
|
||||
try:
|
||||
yield utils.TestUser(
|
||||
group_id=user_data.get("groupId"),
|
||||
user_id=user_data.get("id"),
|
||||
email=user_data.get("email"),
|
||||
token=token,
|
||||
)
|
||||
finally:
|
||||
# TODO: Delete User after test
|
||||
pass
|
Loading…
Add table
Add a link
Reference in a new issue