From 6a835ad192b2239207f163394ce9640de6afe20a Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 19 Dec 2020 23:41:24 +0100 Subject: [PATCH] policies: add simple test-case --- authentik/policies/tests/test_engine.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/authentik/policies/tests/test_engine.py b/authentik/policies/tests/test_engine.py index fe2c808bd..843577aac 100644 --- a/authentik/policies/tests/test_engine.py +++ b/authentik/policies/tests/test_engine.py @@ -34,6 +34,15 @@ class TestPolicyEngine(TestCase): self.assertEqual(result.passing, True) self.assertEqual(result.messages, ()) + def test_engine_simple(self): + """Ensure simplest use-case""" + pbm = PolicyBindingModel.objects.create() + PolicyBinding.objects.create(target=pbm, policy=self.policy_true, order=0) + engine = PolicyEngine(pbm, self.user) + result = engine.build().result + self.assertEqual(result.passing, True) + self.assertEqual(result.messages, ("dummy",)) + def test_engine(self): """Ensure all policies passes (Mix of false and true -> false)""" pbm = PolicyBindingModel.objects.create()