Add identity drift reconciliation
This commit is contained in:
parent
487012e961
commit
26d0e52172
3 changed files with 164 additions and 7 deletions
|
|
@ -3,7 +3,7 @@ import sys
|
|||
import unittest
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).parents[1]))
|
||||
from provisioner import _username, dispatch, Result
|
||||
from provisioner import _username, dispatch, DriftResult, Result
|
||||
|
||||
|
||||
class Fake:
|
||||
|
|
@ -11,6 +11,8 @@ class Fake:
|
|||
def suspend(self, subject): return Result("p", subject, "suspended", False)
|
||||
def reactivate(self, subject): return Result("p", subject, "active", False)
|
||||
def deprovision(self, subject): return Result("p", subject, "deprovisioned", False)
|
||||
def drift(self, payload): return DriftResult("p", payload["external_subject"], "drifted", ("group:missing:t:users",))
|
||||
def reconcile(self, payload): return DriftResult("p", payload["external_subject"], "reconciled", (), ("group:added:t:users",))
|
||||
|
||||
|
||||
class ProvisionerTests(unittest.TestCase):
|
||||
|
|
@ -30,3 +32,16 @@ class ProvisionerTests(unittest.TestCase):
|
|||
"correlation_id": "c",
|
||||
})
|
||||
self.assertEqual("suspended", result.status)
|
||||
|
||||
def test_drift_and_reconcile_dispatch(self):
|
||||
payload = {
|
||||
"external_subject": "u",
|
||||
"tenant": "t",
|
||||
"primary_email": "u@example.com",
|
||||
"idempotency_key": "1234567890123456",
|
||||
"correlation_id": "c",
|
||||
}
|
||||
drift = dispatch(Fake(), "/v1/identities/drift", payload)
|
||||
reconciled = dispatch(Fake(), "/v1/identities/reconcile", payload)
|
||||
self.assertEqual("drifted", drift.status)
|
||||
self.assertEqual("reconciled", reconciled.status)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue