docs(idm): complete delegation lifecycle guidance
This commit is contained in:
@@ -99,6 +99,26 @@ class AssignmentWorkflowTests(unittest.TestCase):
|
||||
),
|
||||
)
|
||||
|
||||
def test_delegated_assignment_rejects_function_that_forbids_delegation(self) -> None:
|
||||
base = assignment(id="source-1")
|
||||
item = assignment(
|
||||
id="assignment-2",
|
||||
identity_id="identity-2",
|
||||
account_id="account-2",
|
||||
source="delegated",
|
||||
delegated_from_assignment_id="source-1",
|
||||
)
|
||||
|
||||
self.assert_invalid(
|
||||
"This organization function does not allow delegation.",
|
||||
lambda: validate_assignment_source_rules( # type: ignore[arg-type]
|
||||
item,
|
||||
function=function(delegable=False),
|
||||
base=base,
|
||||
account_linked_to_identity=lambda _identity_id, _account_id: False,
|
||||
),
|
||||
)
|
||||
|
||||
def test_acting_for_assignment_accepts_identity_linked_account(self) -> None:
|
||||
base = assignment(id="source-1", identity_id="identity-1", account_id=None)
|
||||
item = assignment(
|
||||
@@ -136,6 +156,27 @@ class AssignmentWorkflowTests(unittest.TestCase):
|
||||
),
|
||||
)
|
||||
|
||||
def test_acting_for_assignment_rejects_function_that_forbids_representation(self) -> None:
|
||||
base = assignment(id="source-1")
|
||||
item = assignment(
|
||||
id="assignment-2",
|
||||
identity_id="identity-2",
|
||||
account_id="acting-account",
|
||||
source="acting_for",
|
||||
delegated_from_assignment_id="source-1",
|
||||
acting_for_account_id="account-1",
|
||||
)
|
||||
|
||||
self.assert_invalid(
|
||||
"This organization function does not allow acting in place.",
|
||||
lambda: validate_assignment_source_rules( # type: ignore[arg-type]
|
||||
item,
|
||||
function=function(act_in_place_allowed=False),
|
||||
base=base,
|
||||
account_linked_to_identity=lambda _identity_id, _account_id: False,
|
||||
),
|
||||
)
|
||||
|
||||
def test_update_plan_does_not_mutate_until_applied(self) -> None:
|
||||
item = assignment()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user