authentik.flows.tests.test_stage_views

stage view tests

  1"""stage view tests"""
  2
  3from collections.abc import Callable
  4from unittest.mock import patch
  5
  6from django.test import RequestFactory, TestCase
  7from django.urls import reverse
  8
  9from authentik.core.tests.utils import RequestFactory as AuthentikRequestFactory
 10from authentik.core.tests.utils import create_test_flow
 11from authentik.flows.models import Flow, FlowStageBinding
 12from authentik.flows.planner import PLAN_CONTEXT_CONTINUOUS_LOGIN_HOLD, FlowPlan
 13from authentik.flows.stage import StageView
 14from authentik.flows.views.executor import FlowExecutorView
 15from authentik.lib.utils.reflection import all_subclasses
 16from authentik.stages.dummy.models import DummyStage
 17from authentik.stages.dummy.stage import DummyStageView
 18
 19
 20class TestViews(TestCase):
 21    """Generic model properties tests"""
 22
 23    def setUp(self) -> None:
 24        self.factory = RequestFactory()
 25        self.exec = FlowExecutorView(request=self.factory.get("/"))
 26        self.authentik_factory = AuthentikRequestFactory()
 27
 28    def test_challenge_stage_flow_info_uses_relative_background(self):
 29        """Test challenge flow info keeps background URLs app-relative."""
 30        flow = create_test_flow()
 31        stage = DummyStage.objects.create(name="dummy")
 32        FlowStageBinding.objects.create(target=flow, stage=stage, order=0)
 33        request = self.authentik_factory.get("/")
 34
 35        executor = FlowExecutorView(flow=flow, request=request)
 36        executor.current_stage = stage
 37
 38        view = DummyStageView(executor)
 39        view.request = request
 40
 41        challenge = view._get_challenge()
 42
 43        self.assertEqual(
 44            challenge.initial_data["flow_info"]["background"],
 45            "/static/dist/assets/images/flow_background.jpg",
 46        )
 47
 48    def test_challenge_stage_exposes_continuous_login_hold(self):
 49        """Challenge flow info exposes whether authorization must retain the tab lock."""
 50        flow = create_test_flow()
 51        stage = DummyStage.objects.create(name="dummy")
 52        request = self.authentik_factory.get("/")
 53        plan = FlowPlan(flow_pk=flow.pk.hex)
 54        plan.context[PLAN_CONTEXT_CONTINUOUS_LOGIN_HOLD] = False
 55        executor = FlowExecutorView(flow=flow, request=request, plan=plan)
 56        executor.current_stage = stage
 57        view = DummyStageView(executor)
 58        view.request = request
 59
 60        challenge = view._get_challenge()
 61
 62        self.assertFalse(challenge.initial_data["flow_info"]["continuous_login_hold"])
 63
 64    def test_flow_interface_css_background_preserves_presigned_url_query(self):
 65        """Test flow CSS keeps signed URL query separators intact."""
 66        flow = create_test_flow()
 67        background_url = (
 68            "https://s3.ca-central-1.amazonaws.com/example/media/public/background.png"
 69            "?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=credential"
 70            "&X-Amz-Signature=signature"
 71        )
 72
 73        with patch.object(Flow, "background_url", return_value=background_url):
 74            response = self.client.get(
 75                reverse("authentik_core:if-flow", kwargs={"flow_slug": flow.slug})
 76            )
 77
 78        self.assertContains(
 79            response,
 80            f'--ak-global--background-image: url("{background_url}");',
 81            html=False,
 82        )
 83
 84    def test_flow_sfe_css_background_preserves_presigned_url_query(self):
 85        """Test SFE flow CSS keeps signed URL query separators intact."""
 86        flow = create_test_flow()
 87        background_url = (
 88            "https://s3.ca-central-1.amazonaws.com/example/media/public/background.png"
 89            "?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=credential"
 90            "&X-Amz-Signature=signature"
 91        )
 92
 93        with patch.object(Flow, "background_url", return_value=background_url):
 94            response = self.client.get(
 95                reverse("authentik_core:if-flow", kwargs={"flow_slug": flow.slug}) + "?sfe"
 96            )
 97
 98        self.assertContains(
 99            response,
100            f'background-image: url("{background_url}");',
101            html=False,
102        )
103
104
105def view_tester_factory(view_class: type[StageView]) -> Callable:
106    """Test a form"""
107
108    def tester(self: TestViews):
109        model_class = view_class(self.exec)
110        if not hasattr(model_class, "dispatch"):
111            self.assertIsNotNone(model_class.post)
112            self.assertIsNotNone(model_class.get)
113
114    return tester
115
116
117for view in all_subclasses(StageView):
118    setattr(TestViews, f"test_view_{view.__name__}", view_tester_factory(view))
class TestViews(django.test.testcases.TestCase):
 21class TestViews(TestCase):
 22    """Generic model properties tests"""
 23
 24    def setUp(self) -> None:
 25        self.factory = RequestFactory()
 26        self.exec = FlowExecutorView(request=self.factory.get("/"))
 27        self.authentik_factory = AuthentikRequestFactory()
 28
 29    def test_challenge_stage_flow_info_uses_relative_background(self):
 30        """Test challenge flow info keeps background URLs app-relative."""
 31        flow = create_test_flow()
 32        stage = DummyStage.objects.create(name="dummy")
 33        FlowStageBinding.objects.create(target=flow, stage=stage, order=0)
 34        request = self.authentik_factory.get("/")
 35
 36        executor = FlowExecutorView(flow=flow, request=request)
 37        executor.current_stage = stage
 38
 39        view = DummyStageView(executor)
 40        view.request = request
 41
 42        challenge = view._get_challenge()
 43
 44        self.assertEqual(
 45            challenge.initial_data["flow_info"]["background"],
 46            "/static/dist/assets/images/flow_background.jpg",
 47        )
 48
 49    def test_challenge_stage_exposes_continuous_login_hold(self):
 50        """Challenge flow info exposes whether authorization must retain the tab lock."""
 51        flow = create_test_flow()
 52        stage = DummyStage.objects.create(name="dummy")
 53        request = self.authentik_factory.get("/")
 54        plan = FlowPlan(flow_pk=flow.pk.hex)
 55        plan.context[PLAN_CONTEXT_CONTINUOUS_LOGIN_HOLD] = False
 56        executor = FlowExecutorView(flow=flow, request=request, plan=plan)
 57        executor.current_stage = stage
 58        view = DummyStageView(executor)
 59        view.request = request
 60
 61        challenge = view._get_challenge()
 62
 63        self.assertFalse(challenge.initial_data["flow_info"]["continuous_login_hold"])
 64
 65    def test_flow_interface_css_background_preserves_presigned_url_query(self):
 66        """Test flow CSS keeps signed URL query separators intact."""
 67        flow = create_test_flow()
 68        background_url = (
 69            "https://s3.ca-central-1.amazonaws.com/example/media/public/background.png"
 70            "?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=credential"
 71            "&X-Amz-Signature=signature"
 72        )
 73
 74        with patch.object(Flow, "background_url", return_value=background_url):
 75            response = self.client.get(
 76                reverse("authentik_core:if-flow", kwargs={"flow_slug": flow.slug})
 77            )
 78
 79        self.assertContains(
 80            response,
 81            f'--ak-global--background-image: url("{background_url}");',
 82            html=False,
 83        )
 84
 85    def test_flow_sfe_css_background_preserves_presigned_url_query(self):
 86        """Test SFE flow CSS keeps signed URL query separators intact."""
 87        flow = create_test_flow()
 88        background_url = (
 89            "https://s3.ca-central-1.amazonaws.com/example/media/public/background.png"
 90            "?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=credential"
 91            "&X-Amz-Signature=signature"
 92        )
 93
 94        with patch.object(Flow, "background_url", return_value=background_url):
 95            response = self.client.get(
 96                reverse("authentik_core:if-flow", kwargs={"flow_slug": flow.slug}) + "?sfe"
 97            )
 98
 99        self.assertContains(
100            response,
101            f'background-image: url("{background_url}");',
102            html=False,
103        )

Generic model properties tests

def setUp(self) -> None:
24    def setUp(self) -> None:
25        self.factory = RequestFactory()
26        self.exec = FlowExecutorView(request=self.factory.get("/"))
27        self.authentik_factory = AuthentikRequestFactory()

Hook method for setting up the test fixture before exercising it.

def test_challenge_stage_flow_info_uses_relative_background(self):
29    def test_challenge_stage_flow_info_uses_relative_background(self):
30        """Test challenge flow info keeps background URLs app-relative."""
31        flow = create_test_flow()
32        stage = DummyStage.objects.create(name="dummy")
33        FlowStageBinding.objects.create(target=flow, stage=stage, order=0)
34        request = self.authentik_factory.get("/")
35
36        executor = FlowExecutorView(flow=flow, request=request)
37        executor.current_stage = stage
38
39        view = DummyStageView(executor)
40        view.request = request
41
42        challenge = view._get_challenge()
43
44        self.assertEqual(
45            challenge.initial_data["flow_info"]["background"],
46            "/static/dist/assets/images/flow_background.jpg",
47        )

Test challenge flow info keeps background URLs app-relative.

def test_challenge_stage_exposes_continuous_login_hold(self):
49    def test_challenge_stage_exposes_continuous_login_hold(self):
50        """Challenge flow info exposes whether authorization must retain the tab lock."""
51        flow = create_test_flow()
52        stage = DummyStage.objects.create(name="dummy")
53        request = self.authentik_factory.get("/")
54        plan = FlowPlan(flow_pk=flow.pk.hex)
55        plan.context[PLAN_CONTEXT_CONTINUOUS_LOGIN_HOLD] = False
56        executor = FlowExecutorView(flow=flow, request=request, plan=plan)
57        executor.current_stage = stage
58        view = DummyStageView(executor)
59        view.request = request
60
61        challenge = view._get_challenge()
62
63        self.assertFalse(challenge.initial_data["flow_info"]["continuous_login_hold"])

Challenge flow info exposes whether authorization must retain the tab lock.

def test_flow_interface_css_background_preserves_presigned_url_query(self):
65    def test_flow_interface_css_background_preserves_presigned_url_query(self):
66        """Test flow CSS keeps signed URL query separators intact."""
67        flow = create_test_flow()
68        background_url = (
69            "https://s3.ca-central-1.amazonaws.com/example/media/public/background.png"
70            "?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=credential"
71            "&X-Amz-Signature=signature"
72        )
73
74        with patch.object(Flow, "background_url", return_value=background_url):
75            response = self.client.get(
76                reverse("authentik_core:if-flow", kwargs={"flow_slug": flow.slug})
77            )
78
79        self.assertContains(
80            response,
81            f'--ak-global--background-image: url("{background_url}");',
82            html=False,
83        )

Test flow CSS keeps signed URL query separators intact.

def test_flow_sfe_css_background_preserves_presigned_url_query(self):
 85    def test_flow_sfe_css_background_preserves_presigned_url_query(self):
 86        """Test SFE flow CSS keeps signed URL query separators intact."""
 87        flow = create_test_flow()
 88        background_url = (
 89            "https://s3.ca-central-1.amazonaws.com/example/media/public/background.png"
 90            "?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=credential"
 91            "&X-Amz-Signature=signature"
 92        )
 93
 94        with patch.object(Flow, "background_url", return_value=background_url):
 95            response = self.client.get(
 96                reverse("authentik_core:if-flow", kwargs={"flow_slug": flow.slug}) + "?sfe"
 97            )
 98
 99        self.assertContains(
100            response,
101            f'background-image: url("{background_url}");',
102            html=False,
103        )

Test SFE flow CSS keeps signed URL query separators intact.

def test_view_AccessDeniedStage(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_AccountLockdownStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_AgentAuthFulfillmentStage(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_AuthenticatorDuoStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_AuthenticatorEmailStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_AuthenticatorEndpointStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_AuthenticatorSMSStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_AuthenticatorStaticStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_AuthenticatorTOTPStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_AuthenticatorValidateStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_AuthenticatorWebAuthnStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_AutosubmitStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_CaptchaStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_ChallengeStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_ConsentStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_DenyStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_DummyStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_EmailStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_EmailTokenRevocationConsentStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_EndpointStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_FleetStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_GoogleChromeStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_GrantRequestFinalStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_GroupUpdateStage(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_IdentificationStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_IframeLogoutStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_InvitationStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_MTLSStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_MessageChallengeStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_MessageStage(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_MessageStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_MicrosoftIntuneStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_NativeLogoutStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_NativeLogoutStageViewBase(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_OAuthDeviceCodeFinishStage(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_OAuthDeviceCodeStage(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_OAuthFulfillmentStage(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_PSSOAuthFulfillmentStage(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_PasswordStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_PostSetupStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_PostSourceStage(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_PromptStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_RACFinalStage(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_RedirectStage(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_RedirectStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_RedirectToAppStage(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_RequiredActionCompleteStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_SAMLFlowFinalView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_SessionEndStage(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_SourceStageFinal(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_SourceStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_TelegramLoginView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_UserDeleteStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_UserLoginStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_UserLogoutStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_UserWriteStageView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def test_view_WSFedFlowFinalView(self: TestViews):
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)

The type of the None singleton.

def view_tester_factory(view_class: type[authentik.flows.stage.StageView]) -> Callable:
106def view_tester_factory(view_class: type[StageView]) -> Callable:
107    """Test a form"""
108
109    def tester(self: TestViews):
110        model_class = view_class(self.exec)
111        if not hasattr(model_class, "dispatch"):
112            self.assertIsNotNone(model_class.post)
113            self.assertIsNotNone(model_class.get)
114
115    return tester

Test a form