feat: add tenant-scoped rule and permission management
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
from fastapi_modules.fastapi_leaudit.services.impl.ruleServiceImpl import RuleServiceImpl
|
||||
|
||||
|
||||
def test_build_version_snapshot_uses_explicit_source_version():
|
||||
service = RuleServiceImpl()
|
||||
|
||||
snapshot = service._build_version_scope_snapshot(
|
||||
writable_tenant_code="MZ",
|
||||
writable_scope_type="TENANT",
|
||||
rule_set_row={"tenant_code": "MZ"},
|
||||
source_version_id=321,
|
||||
)
|
||||
|
||||
assert snapshot == {
|
||||
"tenant_code_snapshot": "MZ",
|
||||
"scope_type_snapshot": "TENANT",
|
||||
"source_version_id": 321,
|
||||
}
|
||||
|
||||
|
||||
def test_build_version_snapshot_defaults_to_rule_set_scope_when_tenant_missing():
|
||||
service = RuleServiceImpl()
|
||||
|
||||
snapshot = service._build_version_scope_snapshot(
|
||||
writable_tenant_code=None,
|
||||
writable_scope_type="PROVINCIAL",
|
||||
rule_set_row={"tenant_code": "PUBLIC"},
|
||||
source_version_id=None,
|
||||
)
|
||||
|
||||
assert snapshot == {
|
||||
"tenant_code_snapshot": "PUBLIC",
|
||||
"scope_type_snapshot": "PROVINCIAL",
|
||||
"source_version_id": None,
|
||||
}
|
||||
Reference in New Issue
Block a user