fix(tests): omCapabilities nach UI-Profil-Merge normalisieren
All checks were successful
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Successful in 3m45s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 19s
Test Suite / playwright-smoke (push) Successful in 13s
All checks were successful
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Successful in 3m45s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 19s
Test Suite / playwright-smoke (push) Successful in 13s
test_resolve_ui_profile_merges_seed_slices_when_db_partial erwartet omCapabilities aus dataSlices wenn DB-Profil unvollstaendig ist.
This commit is contained in:
parent
97fab2c76d
commit
1c10e5b798
|
|
@ -54,20 +54,27 @@ def _seed_ui_profile(archetype_key: str) -> dict[str, Any]:
|
||||||
return resolve_ui_profile(archetype_key)
|
return resolve_ui_profile(archetype_key)
|
||||||
|
|
||||||
|
|
||||||
|
def _normalize_ui_profile_capabilities(profile: dict[str, Any]) -> dict[str, Any]:
|
||||||
|
"""Spiegelt resolve_ui_profile: omCapabilities aus dataSlices falls fehlend."""
|
||||||
|
result = dict(profile)
|
||||||
|
slices = list(result.get("dataSlices") or [])
|
||||||
|
caps = list(result.get("omCapabilities") or slices)
|
||||||
|
result["dataSlices"] = slices
|
||||||
|
result["omCapabilities"] = caps
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
def _resolve_ui_profile(archetype_key: str) -> dict[str, Any]:
|
def _resolve_ui_profile(archetype_key: str) -> dict[str, Any]:
|
||||||
seed_profile = _seed_ui_profile(archetype_key)
|
seed_profile = _seed_ui_profile(archetype_key)
|
||||||
db_profile = _load_ui_profile_from_db(archetype_key)
|
db_profile = _load_ui_profile_from_db(archetype_key)
|
||||||
if not db_profile:
|
if not db_profile:
|
||||||
return seed_profile
|
return _normalize_ui_profile_capabilities(seed_profile)
|
||||||
|
|
||||||
merged = {**seed_profile, **db_profile}
|
merged = {**seed_profile, **db_profile}
|
||||||
if not (merged.get("omCapabilities") or merged.get("dataSlices")):
|
if not (merged.get("omCapabilities") or merged.get("dataSlices")):
|
||||||
seed_slices = seed_profile.get("dataSlices") or []
|
seed_slices = seed_profile.get("dataSlices") or []
|
||||||
merged["dataSlices"] = list(seed_slices)
|
merged["dataSlices"] = list(seed_slices)
|
||||||
merged["omCapabilities"] = list(
|
return _normalize_ui_profile_capabilities(merged)
|
||||||
seed_profile.get("omCapabilities") or seed_slices
|
|
||||||
)
|
|
||||||
return merged
|
|
||||||
|
|
||||||
|
|
||||||
def _resolve_om_capabilities(ui_profile: dict[str, Any]) -> frozenset[str]:
|
def _resolve_om_capabilities(ui_profile: dict[str, Any]) -> frozenset[str]:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user