Add scoped LLDAP identity provisioner
This commit is contained in:
parent
86eed20012
commit
ba07dd2acb
7 changed files with 377 additions and 0 deletions
32
identity-provisioner/tests/test_provisioner.py
Normal file
32
identity-provisioner/tests/test_provisioner.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import pathlib
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).parents[1]))
|
||||
from provisioner import _username, dispatch, Result
|
||||
|
||||
|
||||
class Fake:
|
||||
def provision(self, payload): return Result("p", "u", "password_setup_required", False)
|
||||
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)
|
||||
|
||||
|
||||
class ProvisionerTests(unittest.TestCase):
|
||||
def test_username_is_stable_and_sanitized(self):
|
||||
self.assertEqual("bernd.worsch", _username("Bernd.Worsch@binky-hedgehog.com"))
|
||||
|
||||
def test_dispatch_requires_idempotency(self):
|
||||
with self.assertRaisesRegex(ValueError, "idempotency_key"):
|
||||
dispatch(Fake(), "/v1/identities/suspend", {
|
||||
"external_subject": "u", "correlation_id": "c"
|
||||
})
|
||||
|
||||
def test_lifecycle_dispatch(self):
|
||||
result = dispatch(Fake(), "/v1/identities/suspend", {
|
||||
"external_subject": "u",
|
||||
"idempotency_key": "1234567890123456",
|
||||
"correlation_id": "c",
|
||||
})
|
||||
self.assertEqual("suspended", result.status)
|
||||
Loading…
Add table
Add a link
Reference in a new issue