diff --git a/authentik/admin/tests/test_policy_binding.py b/authentik/admin/tests/test_policy_binding.py index 5a964bf81..fc508d446 100644 --- a/authentik/admin/tests/test_policy_binding.py +++ b/authentik/admin/tests/test_policy_binding.py @@ -1,4 +1,5 @@ """admin tests""" +from uuid import uuid4 from django.test import TestCase from django.test.client import RequestFactory @@ -18,7 +19,13 @@ class TestPolicyBindingView(TestCase): view = PolicyBindingCreateView(request=request) self.assertEqual(view.get_initial(), {}) - def test_with_param(self): + def test_with_params_invalid(self): + """Test PolicyBindingCreateView with invalid get params""" + request = self.factory.get("/", {"target": uuid4()}) + view = PolicyBindingCreateView(request=request) + self.assertEqual(view.get_initial(), {}) + + def test_with_params(self): """Test PolicyBindingCreateView with get params""" target = Application.objects.create(name="test") request = self.factory.get("/", {"target": target.pk.hex}) diff --git a/authentik/admin/tests/test_stage_bindings.py b/authentik/admin/tests/test_stage_bindings.py index 169048e4f..0bf0b0b14 100644 --- a/authentik/admin/tests/test_stage_bindings.py +++ b/authentik/admin/tests/test_stage_bindings.py @@ -1,4 +1,5 @@ """admin tests""" +from uuid import uuid4 from django.test import TestCase from django.test.client import RequestFactory @@ -18,7 +19,13 @@ class TestStageBindingView(TestCase): view = StageBindingCreateView(request=request) self.assertEqual(view.get_initial(), {}) - def test_with_param(self): + def test_with_params_invalid(self): + """Test StageBindingCreateView with invalid get params""" + request = self.factory.get("/", {"target": uuid4()}) + view = StageBindingCreateView(request=request) + self.assertEqual(view.get_initial(), {}) + + def test_with_params(self): """Test StageBindingCreateView with get params""" target = Flow.objects.create(name="test", slug="test") request = self.factory.get("/", {"target": target.pk.hex})