def METHOD_NAME(self):
    """Test with a valid pending user and invalid password (trigger logout counter)"""
    plan = FlowPlan(flow_pk=self.flow.pk.hex, bindings=[self.binding], markers=[StageMarker()])
    plan.context[PLAN_CONTEXT_PENDING_USER] = self.user
    session = self.client.session
    session[SESSION_KEY_PLAN] = plan
    session.save()
    for _ in range(self.stage.failed_attempts_before_cancel - 1):
        response = self.client.post(
            reverse(
                "authentik_api:flow-executor",
                kwargs={"flow_slug": self.flow.slug},
            ),
            # Form data
            {"password": self.user.username + "test"},
        )
        self.assertEqual(response.status_code, 200)
        self.assertStageResponse(
            response,
            flow=self.flow,
            response_errors={"password": [{"string": "Invalid password", "code": "invalid"}]},
        )
    response = self.client.post(
        reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}),
        # Form data
        {"password": self.user.username + "test"},
    )
    self.assertEqual(response.status_code, 200)
    # To ensure the plan has been cancelled, check SESSION_KEY_PLAN
    self.assertNotIn(SESSION_KEY_PLAN, self.client.session)
    self.assertStageResponse(response, flow=self.flow, error_message="Unknown error")