authentik
authentik copied to clipboard
flows: return correct status code on error
currently we return status 200 for everything; errors are structured the same as in any other API endpoint
closes #18294
Deploy Preview for authentik-docs ready!
| Name | Link |
|---|---|
| Latest commit | 46ab81afb3ecda651dd6292e73df1406bda97f7c |
| Latest deploy log | https://app.netlify.com/projects/authentik-docs/deploys/6932eed965ea1a0008a87592 |
| Deploy Preview | https://deploy-preview-18293--authentik-docs.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.
Deploy Preview for authentik-integrations canceled.
| Name | Link |
|---|---|
| Latest commit | 46ab81afb3ecda651dd6292e73df1406bda97f7c |
| Latest deploy log | https://app.netlify.com/projects/authentik-integrations/deploys/6932eed93f3cf70008b94ec2 |
Deploy Preview for authentik-storybook canceled.
| Name | Link |
|---|---|
| Latest commit | 46ab81afb3ecda651dd6292e73df1406bda97f7c |
| Latest deploy log | https://app.netlify.com/projects/authentik-storybook/deploys/6932eed92768ee0008947044 |
:x: 35 Tests Failed:
| Tests completed | Failed | Passed | Skipped |
|---|---|---|---|
| 2276 | 35 | 2241 | 2 |
View the top 3 failed test(s) by shortest run time
authentik.stages.email.tests.test_stage.TestEmailStage::test_challenge_invalid_not_rate_limitedStack Traces | 0.764s run time
self = <unittest.case._Outcome object at 0x7f9ede87da20> test_case = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_challenge_invalid_not_rate_limited> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_challenge_invalid_not_rate_limited> result = <TestCaseFunction test_challenge_invalid_not_rate_limited> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_challenge_invalid_not_rate_limited> method = <bound method TestEmailStage.test_challenge_invalid_not_rate_limited of <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_challenge_invalid_not_rate_limited>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_challenge_invalid_not_rate_limited> def test_challenge_invalid_not_rate_limited(self): """Tests that the request is not rate limited and email is sent.""" challenge_response, stage_view, request = self._challenge_invalid_helper() with patch.object(stage_view, "send_email") as mock_send_email: result = stage_view.challenge_invalid(challenge_response) > self.assertEqual(result.status_code, 200) .../email/tests/test_stage.py:433: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_challenge_invalid_not_rate_limited> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_challenge_invalid_not_rate_limited> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.authenticator_validate.tests.test_stage.AuthenticatorValidateStageTests::test_validate_selected_challengeStack Traces | 0.789s run time
self = <unittest.case._Outcome object at 0x7f3573331080> test_case = <authentik.stages.authenticator_validate.tests.test_stage.AuthenticatorValidateStageTests testMethod=test_validate_selected_challenge> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_stage.AuthenticatorValidateStageTests testMethod=test_validate_selected_challenge> result = <TestCaseFunction test_validate_selected_challenge> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_stage.AuthenticatorValidateStageTests testMethod=test_validate_selected_challenge> method = <bound method AuthenticatorValidateStageTests.test_validate_selected_challenge of <authentik.stages.authenticator_validate.tests.test_stage.AuthenticatorValidateStageTests testMethod=test_validate_selected_challenge>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_stage.AuthenticatorValidateStageTests testMethod=test_validate_selected_challenge> def test_validate_selected_challenge(self): """Test validate_selected_challenge""" flow = create_test_flow() stage = AuthenticatorValidateStage.objects.create( name=generate_id(), not_configured_action=NotConfiguredAction.CONFIGURE, device_classes=[DeviceClasses.STATIC, DeviceClasses.TOTP], ) session = self.client.session plan = FlowPlan(flow_pk=flow.pk.hex) plan.append_stage(stage) plan.context[PLAN_CONTEXT_DEVICE_CHALLENGES] = [ { "device_class": DeviceClasses.STATIC, "device_uid": "1", "challenge": {}, "last_used": now(), }, { "device_class": DeviceClasses.TOTP, "device_uid": "2", "challenge": {}, "last_used": now(), }, ] session[SESSION_KEY_PLAN] = plan session.save() response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": flow.slug}), data={ "selected_challenge": { "device_class": DeviceClasses.WEBAUTHN, "device_uid": "quox", "challenge": {}, "last_used": None, } }, ) > self.assertStageResponse( response, flow, response_errors={ "selected_challenge": [{"string": "invalid challenge selected", "code": "invalid"}] }, component="ak-stage-authenticator-validate", ) .../authenticator_validate/tests/test_stage.py:182: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_stage.AuthenticatorValidateStageTests testMethod=test_validate_selected_challenge> response = <HttpChallengeResponse status_code=400, "application/json"> flow = <Flow: Flow N5OdJtdj9B (n5odjtdj9b)>, user = None kwargs = {'component': 'ak-stage-authenticator-validate', 'response_errors': {'selected_challenge': [{'code': 'invalid', 'string': 'invalid challenge selected'}]}} def assertStageResponse( self, response: HttpResponse, flow: Flow | None = None, user: User | None = None, **kwargs, ) -> dict[str, Any]: """Assert various attributes of a stage response""" > self.assertEqual(response.status_code, 200) .../flows/tests/__init__.py:30: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_stage.AuthenticatorValidateStageTests testMethod=test_validate_selected_challenge> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_stage.AuthenticatorValidateStageTests testMethod=test_validate_selected_challenge> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.captcha.tests.TestCaptchaStage::test_invalid_score_highStack Traces | 0.798s run time
self = <unittest.case._Outcome object at 0x7f3573d5e970> test_case = <authentik.stages.captcha.tests.TestCaptchaStage testMethod=test_invalid_score_high> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.captcha.tests.TestCaptchaStage testMethod=test_invalid_score_high> result = <TestCaseFunction test_invalid_score_high> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.captcha.tests.TestCaptchaStage testMethod=test_invalid_score_high> method = <bound method TestCaptchaStage.test_invalid_score_high of <authentik.stages.captcha.tests.TestCaptchaStage testMethod=test_invalid_score_high>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = [<authentik.stages.captcha.tests.TestCaptchaStage testMethod=test_invalid_score_high>, <requests_mock.mocker.Mocker object at 0x7f3585fa3e50>] kwargs = {}, m = <requests_mock.mocker.Mocker object at 0x7f3585fa3e50> @functools.wraps(func) def inner(*args, **kwargs): with self.copy() as m: if self._kw: kwargs[self._kw] = m else: args = list(args) args.append(m) > return func(*args, **kwargs) .venv/lib/python3.13.../site-packages/requests_mock/mocker.py:317: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.captcha.tests.TestCaptchaStage testMethod=test_invalid_score_high> mock = <requests_mock.mocker.Mocker object at 0x7f3585fa3e50> @Mocker() def test_invalid_score_high(self, mock: Mocker): """Test invalid captcha (score too high)""" mock.post( "https://www.recaptcha..../recaptcha/api/siteverify", json={ "success": True, "score": 99, }, ) plan = FlowPlan(flow_pk=self.flow.pk.hex, bindings=[self.binding], markers=[StageMarker()]) session = self.client.session session[SESSION_KEY_PLAN] = plan session.save() response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), {"token": "PASSED"}, ) > self.assertEqual(response.status_code, 200) .../stages/captcha/tests.py:112: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.captcha.tests.TestCaptchaStage testMethod=test_invalid_score_high> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.captcha.tests.TestCaptchaStage testMethod=test_invalid_score_high> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.captcha.tests.TestCaptchaStage::test_invalid_score_lowStack Traces | 0.83s run time
self = <unittest.case._Outcome object at 0x7f357c39f8c0> test_case = <authentik.stages.captcha.tests.TestCaptchaStage testMethod=test_invalid_score_low> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.captcha.tests.TestCaptchaStage testMethod=test_invalid_score_low> result = <TestCaseFunction test_invalid_score_low> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.captcha.tests.TestCaptchaStage testMethod=test_invalid_score_low> method = <bound method TestCaptchaStage.test_invalid_score_low of <authentik.stages.captcha.tests.TestCaptchaStage testMethod=test_invalid_score_low>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = [<authentik.stages.captcha.tests.TestCaptchaStage testMethod=test_invalid_score_low>, <requests_mock.mocker.Mocker object at 0x7f3585fdd7d0>] kwargs = {}, m = <requests_mock.mocker.Mocker object at 0x7f3585fdd7d0> @functools.wraps(func) def inner(*args, **kwargs): with self.copy() as m: if self._kw: kwargs[self._kw] = m else: args = list(args) args.append(m) > return func(*args, **kwargs) .venv/lib/python3.13.../site-packages/requests_mock/mocker.py:317: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.captcha.tests.TestCaptchaStage testMethod=test_invalid_score_low> mock = <requests_mock.mocker.Mocker object at 0x7f3585fdd7d0> @Mocker() def test_invalid_score_low(self, mock: Mocker): """Test invalid captcha (score too low)""" mock.post( "https://www.recaptcha..../recaptcha/api/siteverify", json={ "success": True, "score": -3, }, ) plan = FlowPlan(flow_pk=self.flow.pk.hex, bindings=[self.binding], markers=[StageMarker()]) session = self.client.session session[SESSION_KEY_PLAN] = plan session.save() response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), {"token": "PASSED"}, ) > self.assertEqual(response.status_code, 200) .../stages/captcha/tests.py:137: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.captcha.tests.TestCaptchaStage testMethod=test_invalid_score_low> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.captcha.tests.TestCaptchaStage testMethod=test_invalid_score_low> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests::test_no_deviceStack Traces | 0.86s run time
self = <unittest.case._Outcome object at 0x7f9a517f1f60> test_case = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_no_device> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_no_device> result = <TestCaseFunction test_no_device> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_no_device> method = <bound method AuthenticatorValidateStageEmailTests.test_no_device of <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_no_device>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_no_device> def test_no_device(self): """Test validator stage without configured device""" configuration_stage = AuthenticatorEmailStage.objects.create( name=generate_id(), use_global_settings=True, from_address="[email protected]", ) stage = AuthenticatorValidateStage.objects.create( name=generate_id(), not_configured_action=NotConfiguredAction.CONFIGURE, device_classes=[DeviceClasses.EMAIL], ) stage.configuration_stages.set([configuration_stage]) flow = create_test_flow() FlowStageBinding.objects.create(target=flow, stage=stage, order=2) response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": flow.slug}), {"component": "ak-stage-authenticator-validate"}, ) > self.assertEqual(response.status_code, 200) .../authenticator_validate/tests/test_email.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_no_device> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_no_device> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.consent.tests.TestConsentStage::test_mismatched_tokenStack Traces | 0.87s run time
self = <unittest.case._Outcome object at 0x7f51c67e7620> test_case = <authentik.stages.consent.tests.TestConsentStage testMethod=test_mismatched_token> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.consent.tests.TestConsentStage testMethod=test_mismatched_token> result = <TestCaseFunction test_mismatched_token> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.consent.tests.TestConsentStage testMethod=test_mismatched_token> method = <bound method TestConsentStage.test_mismatched_token of <authentik.stages.consent.tests.TestConsentStage testMethod=test_mismatched_token>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.consent.tests.TestConsentStage testMethod=test_mismatched_token> def test_mismatched_token(self): """Test incorrect token""" flow = create_test_flow(FlowDesignation.AUTHENTICATION) stage = ConsentStage.objects.create(name=generate_id(), mode=ConsentMode.ALWAYS_REQUIRE) binding = FlowStageBinding.objects.create(target=flow, stage=stage, order=2) plan = FlowPlan(flow_pk=flow.pk.hex, bindings=[binding], markers=[StageMarker()]) session = self.client.session session[SESSION_KEY_PLAN] = plan session.save() response = self.client.get( reverse("authentik_api:flow-executor", kwargs={"flow_slug": flow.slug}), ) self.assertEqual(response.status_code, 200) session = self.client.session response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": flow.slug}), { "token": generate_id(), }, ) > self.assertEqual(response.status_code, 200) .../stages/consent/tests.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.consent.tests.TestConsentStage testMethod=test_mismatched_token> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.consent.tests.TestConsentStage testMethod=test_mismatched_token> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.email.tests.test_stage.TestEmailStage::test_challenge_invalid_returns_error_if_rate_limitedStack Traces | 0.87s run time
self = <unittest.case._Outcome object at 0x7f9edf567f50> test_case = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_challenge_invalid_returns_error_if_rate_limited> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_challenge_invalid_returns_error_if_rate_limited> result = <TestCaseFunction test_challenge_invalid_returns_error_if_rate_limited> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_challenge_invalid_returns_error_if_rate_limited> method = <bound method TestEmailStage.test_challenge_invalid_returns_error_if_rate_limited of <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_challenge_invalid_returns_error_if_rate_limited>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_challenge_invalid_returns_error_if_rate_limited> def test_challenge_invalid_returns_error_if_rate_limited(self): """Tests that an error is returned if the request is rate limited. Ensure that an email is not sent.""" challenge_response, stage_view, request = self._challenge_invalid_helper() # Initial request that shouldn't be rate limited stage_view.challenge_invalid(challenge_response) with patch.object(stage_view, "send_email") as mock_send_email: # This next request should be rate limited result = stage_view.challenge_invalid(challenge_response) > self.assertEqual(result.status_code, 200) .../email/tests/test_stage.py:456: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_challenge_invalid_returns_error_if_rate_limited> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_challenge_invalid_returns_error_if_rate_limited> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.authenticator_webauthn.tests.TestAuthenticatorWebAuthnStage::test_register_max_retriesStack Traces | 0.912s run time
self = <unittest.case._Outcome object at 0x7f9a47338440> test_case = <authentik.stages.authenticator_webauthn.tests.TestAuthenticatorWebAuthnStage testMethod=test_register_max_retries> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_webauthn.tests.TestAuthenticatorWebAuthnStage testMethod=test_register_max_retries> result = <TestCaseFunction test_register_max_retries> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_webauthn.tests.TestAuthenticatorWebAuthnStage testMethod=test_register_max_retries> method = <bound method TestAuthenticatorWebAuthnStage.test_register_max_retries of <authentik.stages.authenticator_webauthn.tests.TestAuthenticatorWebAuthnStage testMethod=test_register_max_retries>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_webauthn.tests.TestAuthenticatorWebAuthnStage testMethod=test_register_max_retries> def test_register_max_retries(self): """Test registration (exceeding max retries)""" self.stage.max_attempts = 2 self.stage.save() plan = FlowPlan(flow_pk=self.flow.pk.hex, bindings=[self.binding], markers=[StageMarker()]) plan.context[PLAN_CONTEXT_PENDING_USER] = self.user plan.context[PLAN_CONTEXT_WEBAUTHN_CHALLENGE] = b64decode( b"03Xodi54gKsfnP5I9VFfhaGXVVE2NUyZpBBXns/JI+x6V9RY2Tw2QmxRJkhh7174EkRazUntIwjMVY9bFG60Lw==" ) session = self.client.session session[SESSION_KEY_PLAN] = plan session.save() # first failed request response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), data={ "component": "ak-stage-authenticator-webauthn", "response": { "id": "kqnmrVLnDG-OwsSNHkihYZaNz5s", "rawId": "kqnmrVLnDG-OwsSNHkihYZaNz5s", "type": "public-key", "registrationClientExtensions": "{}", "response": { "clientDataJSON": ( "eyJ0eXBlIjoid2ViYXV0aG4uY3JlYXRlIiwiY2hhbGxlbmd" "lIjoiMDNYb2RpNTRnS3NmblA1STlWRmZoYUdYVlZFMk5VeV" "pwQkJYbnNfSkkteDZWOVJZMlR3MlFteFJKa2hoNzE3NEVrU" "mF6VW50SXdqTVZZOWJGRzYwTHciLCJvcmlnaW4iOiJodHRw" "Oi8vbG9jYWxob3N0OjkwMDAiLCJjcm9zc09yaWdpbiI6ZmF" ), "attestationObject": ( "o2NmbXRkbm9uZWdhdHRTdG10oGhhdXRoRGF0YViYSZYN5Yg" "OjGh0NBcPZHZgW4_krrmihjLHmVzzuoMdl2NdAAAAAPv8MA" "cVTk7MjAtuAgVX170AFJKp5q1S5wxvjsLEjR5IoWGWjc-bp" "QECAyYgASFYIKtcZHPumH37XHs0IM1v3pUBRIqHVV_SE-Lq" "2zpJAOVXIlgg74Fg_WdB0kuLYqCKbxogkEPaVtR_iR3IyQFIJAXBzds" ), }, }, }, SERVER_NAME="localhost", SERVER_PORT="9000", ) > self.assertEqual(response.status_code, 200) .../stages/authenticator_webauthn/tests.py:350: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_webauthn.tests.TestAuthenticatorWebAuthnStage testMethod=test_register_max_retries> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_webauthn.tests.TestAuthenticatorWebAuthnStage testMethod=test_register_max_retries> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.policies.password.tests.test_flows.TestPasswordPolicyFlow::test_prompt_dataStack Traces | 0.96s run time
self = <unittest.case._Outcome object at 0x7f51d464dc50> test_case = <authentik.policies.password.tests.test_flows.TestPasswordPolicyFlow testMethod=test_prompt_data> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.policies.password.tests.test_flows.TestPasswordPolicyFlow testMethod=test_prompt_data> result = <TestCaseFunction test_prompt_data> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.policies.password.tests.test_flows.TestPasswordPolicyFlow testMethod=test_prompt_data> method = <bound method TestPasswordPolicyFlow.test_prompt_data of <authentik.policies.password.tests.test_flows.TestPasswordPolicyFlow testMethod=test_prompt_data>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.policies.password.tests.test_flows.TestPasswordPolicyFlow testMethod=test_prompt_data> def test_prompt_data(self): """Test policy attached to a prompt stage""" response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), {"password": "akadmin"}, ) > self.assertStageResponse( response, self.flow, component="ak-stage-prompt", fields=[ { "choices": None, "field_key": "password", "label": "PASSWORD_LABEL", "order": 0, "placeholder": "PASSWORD_PLACEHOLDER", "initial_value": "", "required": True, "type": "password", "sub_text": "", } ], response_errors={ "non_field_errors": [{"code": "invalid", "string": self.policy.error_message}] }, ) .../password/tests/test_flows.py:52: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.policies.password.tests.test_flows.TestPasswordPolicyFlow testMethod=test_prompt_data> response = <HttpChallengeResponse status_code=400, "application/json"> flow = <Flow: Flow iliGTncFdm (iligtncfdm)>, user = None kwargs = {'component': 'ak-stage-prompt', 'fields': [{'choices': None, 'field_key': 'password', 'initial_value': '', 'label': 'PASSWORD_LABEL', ...}], 'response_errors': {'non_field_errors': [{'code': 'invalid', 'string': 'test message'}]}} def assertStageResponse( self, response: HttpResponse, flow: Flow | None = None, user: User | None = None, **kwargs, ) -> dict[str, Any]: """Assert various attributes of a stage response""" > self.assertEqual(response.status_code, 200) .../flows/tests/__init__.py:30: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.policies.password.tests.test_flows.TestPasswordPolicyFlow testMethod=test_prompt_data> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.policies.password.tests.test_flows.TestPasswordPolicyFlow testMethod=test_prompt_data> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.endpoints.connectors.agent.tests.test_stage.TestEndpointStage::test_endpoint_stage_required_invalidStack Traces | 1.29s run time
self = <unittest.case._Outcome object at 0x7f51c76a7770> test_case = <authentik.endpoints.connectors.agent.tests.test_stage.TestEndpointStage testMethod=test_endpoint_stage_required_invalid> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.endpoints.connectors.agent.tests.test_stage.TestEndpointStage testMethod=test_endpoint_stage_required_invalid> result = <TestCaseFunction test_endpoint_stage_required_invalid> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.endpoints.connectors.agent.tests.test_stage.TestEndpointStage testMethod=test_endpoint_stage_required_invalid> method = <bound method TestEndpointStage.test_endpoint_stage_required_invalid of <authentik.endpoints.connectors.agent.tests.test_stage.TestEndpointStage testMethod=test_endpoint_stage_required_invalid>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.endpoints.connectors.agent.tests.test_stage.TestEndpointStage testMethod=test_endpoint_stage_required_invalid> def test_endpoint_stage_required_invalid(self): flow = create_test_flow() stage = EndpointStage.objects.create(connector=self.connector, mode=StageMode.REQUIRED) FlowStageBinding.objects.create(stage=stage, target=flow, order=0) res = self.client.get( reverse("authentik_api:flow-executor", kwargs={"flow_slug": flow.slug}), ) self.assertEqual(res.status_code, 200) self.assertStageResponse(res, flow=flow, component="ak-stage-endpoint-agent") res = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": flow.slug}), data={"component": "ak-stage-endpoint-agent", "response": generate_id()}, ) > self.assertStageResponse( res, flow=flow, component="ak-stage-endpoint-agent", response_errors={ "response": [{"string": "Invalid challenge response", "code": "invalid"}] }, ) .../agent/tests/test_stage.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.endpoints.connectors.agent.tests.test_stage.TestEndpointStage testMethod=test_endpoint_stage_required_invalid> response = <HttpChallengeResponse status_code=400, "application/json"> flow = <Flow: Flow pCECdU2BJZ (pcecdu2bjz)>, user = None kwargs = {'component': 'ak-stage-endpoint-agent', 'response_errors': {'response': [{'code': 'invalid', 'string': 'Invalid challenge response'}]}} def assertStageResponse( self, response: HttpResponse, flow: Flow | None = None, user: User | None = None, **kwargs, ) -> dict[str, Any]: """Assert various attributes of a stage response""" > self.assertEqual(response.status_code, 200) .../flows/tests/__init__.py:30: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.endpoints.connectors.agent.tests.test_stage.TestEndpointStage testMethod=test_endpoint_stage_required_invalid> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.endpoints.connectors.agent.tests.test_stage.TestEndpointStage testMethod=test_endpoint_stage_required_invalid> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.email.tests.test_stage.TestEmailStage::test_token_invalid_userStack Traces | 1.32s run time
self = <unittest.case._Outcome object at 0x7f9ede815010> test_case = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token_invalid_user> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token_invalid_user> result = <TestCaseFunction test_token_invalid_user> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token_invalid_user> method = <bound method TestEmailStage.test_token_invalid_user of <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token_invalid_user>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token_invalid_user> def test_token_invalid_user(self): """Test with token with invalid user""" # Make sure token exists > self.test_pending_user() .../email/tests/test_stage.py:193: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (<authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token_invalid_user>,) keywargs = {} newargs = (<authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token_invalid_user>,) newkeywargs = {} @wraps(func) def patched(*args, **keywargs): with self.decoration_helper(patched, args, keywargs) as (newargs, newkeywargs): > return func(*newargs, **newkeywargs) .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/mock.py:1426: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token_invalid_user> @patch( "authentik.stages.email.models.EmailStage.backend_class", PropertyMock(return_value=EmailBackend), ) def test_pending_user(self): """Test with pending user""" 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() url = reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}) response = self.client.post(url) > self.assertEqual(response.status_code, 200) .../email/tests/test_stage.py:102: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token_invalid_user> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token_invalid_user> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.email.tests.test_stage.TestEmailStage::test_tokenStack Traces | 1.33s run time
self = <unittest.case._Outcome object at 0x7f9edf78a3c0> test_case = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token> result = <TestCaseFunction test_token> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token> method = <bound method TestEmailStage.test_token of <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token> def test_token(self): """Test with token""" # Make sure token exists > self.test_pending_user() .../email/tests/test_stage.py:140: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (<authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token>,) keywargs = {} newargs = (<authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token>,) newkeywargs = {} @wraps(func) def patched(*args, **keywargs): with self.decoration_helper(patched, args, keywargs) as (newargs, newkeywargs): > return func(*newargs, **newkeywargs) .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/mock.py:1426: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token> @patch( "authentik.stages.email.models.EmailStage.backend_class", PropertyMock(return_value=EmailBackend), ) def test_pending_user(self): """Test with pending user""" 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() url = reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}) response = self.client.post(url) > self.assertEqual(response.status_code, 200) .../email/tests/test_stage.py:102: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_token> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.email.tests.test_stage.TestEmailStage::test_pending_user_overrideStack Traces | 1.4s run time
self = <unittest.case._Outcome object at 0x7f9edeb0e9e0> test_case = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_pending_user_override> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_pending_user_override> result = <TestCaseFunction test_pending_user_override> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_pending_user_override> method = <bound method TestEmailStage.test_pending_user_override of <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_pending_user_override>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (<authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_pending_user_override>,) keywargs = {} newargs = (<authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_pending_user_override>,) newkeywargs = {} @wraps(func) def patched(*args, **keywargs): with self.decoration_helper(patched, args, keywargs) as (newargs, newkeywargs): > return func(*newargs, **newkeywargs) .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/mock.py:1426: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_pending_user_override> @patch( "authentik.stages.email.models.EmailStage.backend_class", PropertyMock(return_value=EmailBackend), ) def test_pending_user_override(self): """Test with pending user (override to)""" plan = FlowPlan(flow_pk=self.flow.pk.hex, bindings=[self.binding], markers=[StageMarker()]) plan.context[PLAN_CONTEXT_PENDING_USER] = self.user plan.context[PLAN_CONTEXT_EMAIL_OVERRIDE] = "[email protected]" session = self.client.session session[SESSION_KEY_PLAN] = plan session.save() url = reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}) response = self.client.post(url) > self.assertEqual(response.status_code, 200) .../email/tests/test_stage.py:122: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_pending_user_override> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_pending_user_override> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.email.tests.test_stage.TestEmailStage::test_pending_userStack Traces | 1.41s run time
self = <unittest.case._Outcome object at 0x7f9ede814c20> test_case = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_pending_user> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_pending_user> result = <TestCaseFunction test_pending_user> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_pending_user> method = <bound method TestEmailStage.test_pending_user of <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_pending_user>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (<authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_pending_user>,) keywargs = {} newargs = (<authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_pending_user>,) newkeywargs = {} @wraps(func) def patched(*args, **keywargs): with self.decoration_helper(patched, args, keywargs) as (newargs, newkeywargs): > return func(*newargs, **newkeywargs) .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/mock.py:1426: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_pending_user> @patch( "authentik.stages.email.models.EmailStage.backend_class", PropertyMock(return_value=EmailBackend), ) def test_pending_user(self): """Test with pending user""" 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() url = reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}) response = self.client.post(url) > self.assertEqual(response.status_code, 200) .../email/tests/test_stage.py:102: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_pending_user> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.email.tests.test_stage.TestEmailStage testMethod=test_pending_user> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9................../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests::test_stage_submitStack Traces | 1.53s run time
self = <unittest.case._Outcome object at 0x7f9a5018c8a0> test_case = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit> result = <TestCaseFunction test_stage_submit> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit> method = <bound method AuthenticatorSMSStageTests.test_stage_submit of <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit> def test_stage_submit(self): """test stage (submit)""" self.client.get( reverse("authentik_flows:configure", kwargs={"stage_uuid": self.stage.stage_uuid}), ) response = self.client.get( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), ) self.assertStageResponse( response, self.flow, self.user, component="ak-stage-authenticator-sms", phone_number_required=True, ) sms_send_mock = MagicMock() with patch( "authentik.stages.authenticator_sms.models.AuthenticatorSMSStage.send", sms_send_mock, ): response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), data={"component": "ak-stage-authenticator-sms", "phone_number": "foo"}, ) > self.assertEqual(response.status_code, 200) .../stages/authenticator_sms/tests.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests::test_stage_submit_fullStack Traces | 1.55s run time
self = <unittest.case._Outcome object at 0x7f9a47746d60> test_case = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit_full> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit_full> result = <TestCaseFunction test_stage_submit_full> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit_full> method = <bound method AuthenticatorSMSStageTests.test_stage_submit_full of <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit_full>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit_full> def test_stage_submit_full(self): """test stage (submit)""" self.client.get( reverse("authentik_flows:configure", kwargs={"stage_uuid": self.stage.stage_uuid}), ) response = self.client.get( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), ) self.assertStageResponse( response, self.flow, self.user, component="ak-stage-authenticator-sms", phone_number_required=True, ) sms_send_mock = MagicMock() with patch( "authentik.stages.authenticator_sms.models.AuthenticatorSMSStage.send", sms_send_mock, ): response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), data={"component": "ak-stage-authenticator-sms", "phone_number": "foo"}, ) > self.assertEqual(response.status_code, 200) .../stages/authenticator_sms/tests.py:240: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit_full> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit_full> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests::test_stage_hashStack Traces | 1.58s run time
self = <unittest.case._Outcome object at 0x7f9a5116b1c0> test_case = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_hash> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_hash> result = <TestCaseFunction test_stage_hash> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_hash> method = <bound method AuthenticatorSMSStageTests.test_stage_hash of <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_hash>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_hash> def test_stage_hash(self): """test stage (verify_only)""" self.stage.verify_only = True self.stage.save() self.client.get( reverse("authentik_flows:configure", kwargs={"stage_uuid": self.stage.stage_uuid}), ) response = self.client.get( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), ) self.assertStageResponse( response, self.flow, self.user, component="ak-stage-authenticator-sms", phone_number_required=True, ) sms_send_mock = MagicMock() with patch( "authentik.stages.authenticator_sms.models.AuthenticatorSMSStage.send", sms_send_mock, ): response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), data={"component": "ak-stage-authenticator-sms", "phone_number": "foo"}, ) > self.assertEqual(response.status_code, 200) .../stages/authenticator_sms/tests.py:291: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_hash> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_hash> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.identification.tests.TestIdentificationStage::test_invalid_with_captchaStack Traces | 1.68s run time
self = <unittest.case._Outcome object at 0x7f51d82d8e50> test_case = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_captcha> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_captcha> result = <TestCaseFunction test_invalid_with_captcha> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_captcha> method = <bound method TestIdentificationStage.test_invalid_with_captcha of <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_captcha>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = [<authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_captcha>, <requests_mock.mocker.Mocker object at 0x7f51c3108750>] kwargs = {}, m = <requests_mock.mocker.Mocker object at 0x7f51c3108750> @functools.wraps(func) def inner(*args, **kwargs): with self.copy() as m: if self._kw: kwargs[self._kw] = m else: args = list(args) args.append(m) > return func(*args, **kwargs) .venv/lib/python3.13.../site-packages/requests_mock/mocker.py:317: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_captcha> mock = <requests_mock.mocker.Mocker object at 0x7f51c3108750> @Mocker() def test_invalid_with_captcha(self, mock: Mocker): """Test with valid email and invalid captcha token in single step""" mock.post( "https://www.recaptcha..../recaptcha/api/siteverify", json={ "success": False, "score": 0.5, }, ) captcha_stage = CaptchaStage.objects.create( name="captcha", public_key=RECAPTCHA_PUBLIC_KEY, private_key=RECAPTCHA_PRIVATE_KEY, ) self.stage.captcha_stage = captcha_stage self.stage.save() form_data = { "uid_field": self.user.email, "captcha_token": "FAILED", } url = reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}) response = self.client.post(url, form_data) > self.assertStageResponse( response, self.flow, component="ak-stage-identification", password_fields=False, primary_action="Log in", response_errors={ "non_field_errors": [{"code": "invalid", "string": "Failed to authenticate."}] }, sources=[ { "challenge": { "component": "xak-flow-redirect", "to": ".../oauth/login/test/", }, "icon_url": ".../authentik/sources/default.svg", "name": "test", "promoted": False, } ], show_source_labels=False, user_fields=["email"], ) .../stages/identification/tests.py:192: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_captcha> response = <HttpChallengeResponse status_code=400, "application/json"> flow = <Flow: Flow sMWDJTrIWN (smwdjtriwn)>, user = None kwargs = {'component': 'ak-stage-identification', 'password_fields': False, 'primary_action': 'Log in', 'response_errors': {'non_field_errors': [{'code': 'invalid', 'string': 'Failed to authenticate.'}]}, ...} def assertStageResponse( self, response: HttpResponse, flow: Flow | None = None, user: User | None = None, **kwargs, ) -> dict[str, Any]: """Assert various attributes of a stage response""" > self.assertEqual(response.status_code, 200) .../flows/tests/__init__.py:30: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_captcha> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_captcha> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.identification.tests.TestIdentificationStage::test_invalid_with_captcha_retriableStack Traces | 1.71s run time
self = <unittest.case._Outcome object at 0x7f51c6280280> test_case = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_captcha_retriable> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_captcha_retriable> result = <TestCaseFunction test_invalid_with_captcha_retriable> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_captcha_retriable> method = <bound method TestIdentificationStage.test_invalid_with_captcha_retriable of <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_captcha_retriable>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = [<authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_captcha_retriable>, <requests_mock.mocker.Mocker object at 0x7f51c3dfc9d0>] kwargs = {}, m = <requests_mock.mocker.Mocker object at 0x7f51c3dfc9d0> @functools.wraps(func) def inner(*args, **kwargs): with self.copy() as m: if self._kw: kwargs[self._kw] = m else: args = list(args) args.append(m) > return func(*args, **kwargs) .venv/lib/python3.13.../site-packages/requests_mock/mocker.py:317: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_captcha_retriable> mock = <requests_mock.mocker.Mocker object at 0x7f51c3dfc9d0> @Mocker() def test_invalid_with_captcha_retriable(self, mock: Mocker): """Test with valid email and invalid captcha token in single step""" mock.post( "https://www.recaptcha..../recaptcha/api/siteverify", json={ "success": False, "score": 0.5, "error-codes": ["timeout-or-duplicate"], }, ) captcha_stage = CaptchaStage.objects.create( name="captcha", public_key=RECAPTCHA_PUBLIC_KEY, private_key=RECAPTCHA_PRIVATE_KEY, ) self.stage.captcha_stage = captcha_stage self.stage.save() form_data = { "uid_field": self.user.email, "captcha_token": "FAILED", } url = reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}) response = self.client.post(url, form_data) > self.assertStageResponse( response, self.flow, component="ak-stage-identification", password_fields=False, primary_action="Log in", response_errors={ "non_field_errors": [ { "code": "invalid", "string": "Failed to authenticate.", } ] }, sources=[ { "challenge": { "component": "xak-flow-redirect", "to": ".../oauth/login/test/", }, "icon_url": ".../authentik/sources/default.svg", "name": "test", "promoted": False, } ], show_source_labels=False, user_fields=["email"], ) .../stages/identification/tests.py:243: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_captcha_retriable> response = <HttpChallengeResponse status_code=400, "application/json"> flow = <Flow: Flow d7XhVCbHx8 (d7xhvcbhx8)>, user = None kwargs = {'component': 'ak-stage-identification', 'password_fields': False, 'primary_action': 'Log in', 'response_errors': {'non_field_errors': [{'code': 'invalid', 'string': 'Failed to authenticate.'}]}, ...} def assertStageResponse( self, response: HttpResponse, flow: Flow | None = None, user: User | None = None, **kwargs, ) -> dict[str, Any]: """Assert various attributes of a stage response""" > self.assertEqual(response.status_code, 200) .../flows/tests/__init__.py:30: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_captcha_retriable> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_captcha_retriable> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.password.tests.TestPasswordStage::test_invalid_password_lockoutStack Traces | 1.72s run time
self = <unittest.case._Outcome object at 0x7f9a47746d60> test_case = <authentik.stages.password.tests.TestPasswordStage testMethod=test_invalid_password_lockout> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.password.tests.TestPasswordStage testMethod=test_invalid_password_lockout> result = <TestCaseFunction test_invalid_password_lockout> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.password.tests.TestPasswordStage testMethod=test_invalid_password_lockout> method = <bound method TestPasswordStage.test_invalid_password_lockout of <authentik.stages.password.tests.TestPasswordStage testMethod=test_invalid_password_lockout>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.password.tests.TestPasswordStage testMethod=test_invalid_password_lockout> def test_invalid_password_lockout(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) .../stages/password/tests.py:147: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.password.tests.TestPasswordStage testMethod=test_invalid_password_lockout> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.password.tests.TestPasswordStage testMethod=test_invalid_password_lockout> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests::test_invalid_codeStack Traces | 1.72s run time
self = <unittest.case._Outcome object at 0x7f9a50a516a0> test_case = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_invalid_code> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_invalid_code> result = <TestCaseFunction test_invalid_code> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_invalid_code> method = <bound method AuthenticatorValidateStageEmailTests.test_invalid_code of <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_invalid_code>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_invalid_code> def test_invalid_code(self): """Test validator stage with invalid code""" # Create a device for our user device = EmailDevice.objects.create( user=self.user, confirmed=True, stage=self.stage, email="[email protected]", ) # First identify the user self._identify_user() # Send the challenge > self._send_challenge(device) .../authenticator_validate/tests/test_email.py:155: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_invalid_code> device = <EmailDevice: Email Device for 269> def _send_challenge(self, device): """Helper to send challenge for device""" response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), { "component": "ak-stage-authenticator-validate", "selected_challenge": { "device_class": "email", "device_uid": str(device.pk), "challenge": {}, "last_used": device.last_used.isoformat() if device.last_used else None, }, }, ) > self.assertEqual(response.status_code, 200) .../authenticator_validate/tests/test_email.py:67: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_invalid_code> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_invalid_code> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.password.tests.TestPasswordStage::test_invalid_passwordStack Traces | 1.73s run time
self = <unittest.case._Outcome object at 0x7f9a50d57150> test_case = <authentik.stages.password.tests.TestPasswordStage testMethod=test_invalid_password> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.password.tests.TestPasswordStage testMethod=test_invalid_password> result = <TestCaseFunction test_invalid_password> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.password.tests.TestPasswordStage testMethod=test_invalid_password> method = <bound method TestPasswordStage.test_invalid_password of <authentik.stages.password.tests.TestPasswordStage testMethod=test_invalid_password>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.password.tests.TestPasswordStage testMethod=test_invalid_password> def test_invalid_password(self): """Test with a valid pending user and invalid password""" 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() 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) .../stages/password/tests.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.password.tests.TestPasswordStage testMethod=test_invalid_password> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.password.tests.TestPasswordStage testMethod=test_invalid_password> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.password.tests.TestPasswordStage::test_valid_password_inactiveStack Traces | 1.76s run time
self = <unittest.case._Outcome object at 0x7f9a50d56d60> test_case = <authentik.stages.password.tests.TestPasswordStage testMethod=test_valid_password_inactive> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.password.tests.TestPasswordStage testMethod=test_valid_password_inactive> result = <TestCaseFunction test_valid_password_inactive> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.password.tests.TestPasswordStage testMethod=test_valid_password_inactive> method = <bound method TestPasswordStage.test_valid_password_inactive of <authentik.stages.password.tests.TestPasswordStage testMethod=test_valid_password_inactive>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.password.tests.TestPasswordStage testMethod=test_valid_password_inactive> def test_valid_password_inactive(self): """Test with a valid pending user and valid password""" self.user.is_active = False self.user.save() 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() response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), # Form data {"password": self.user.username}, ) > self.assertEqual(response.status_code, 200) .../stages/password/tests.py:108: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.password.tests.TestPasswordStage testMethod=test_valid_password_inactive> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.password.tests.TestPasswordStage testMethod=test_valid_password_inactive> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.identification.tests.TestIdentificationStage::test_invalid_with_password_pretendStack Traces | 1.81s run time
self = <unittest.case._Outcome object at 0x7f51c5cda7b0> test_case = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_password_pretend> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_password_pretend> result = <TestCaseFunction test_invalid_with_password_pretend> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_password_pretend> method = <bound method TestIdentificationStage.test_invalid_with_password_pretend of <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_password_pretend>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_password_pretend> def test_invalid_with_password_pretend(self): """Test with invalid email and invalid password in single step (with pretend_user_exists)""" self.stage.pretend_user_exists = True pw_stage = PasswordStage.objects.create(name="password", backends=[BACKEND_INBUILT]) self.stage.password_stage = pw_stage self.stage.save() form_data = { "uid_field": self.user.email + "test", "password": self.user.username + "test", } url = reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}) response = self.client.post(url, form_data) > self.assertStageResponse( response, self.flow, component="ak-stage-identification", password_fields=True, primary_action="Log in", response_errors={ "non_field_errors": [{"code": "invalid", "string": "Failed to authenticate."}] }, sources=[ { "challenge": { "component": "xak-flow-redirect", "to": ".../oauth/login/test/", }, "icon_url": ".../authentik/sources/default.svg", "name": "test", "promoted": False, } ], show_source_labels=False, user_fields=["email"], ) .../stages/identification/tests.py:117: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_password_pretend> response = <HttpChallengeResponse status_code=400, "application/json"> flow = <Flow: Flow 4IgXuZlkB5 (4igxuzlkb5)>, user = None kwargs = {'component': 'ak-stage-identification', 'password_fields': True, 'primary_action': 'Log in', 'response_errors': {'non_field_errors': [{'code': 'invalid', 'string': 'Failed to authenticate.'}]}, ...} def assertStageResponse( self, response: HttpResponse, flow: Flow | None = None, user: User | None = None, **kwargs, ) -> dict[str, Any]: """Assert various attributes of a stage response""" > self.assertEqual(response.status_code, 200) .../flows/tests/__init__.py:30: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_password_pretend> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_password_pretend> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.identification.tests.TestIdentificationStage::test_invalid_with_invalid_emailStack Traces | 1.82s run time
self = <unittest.case._Outcome object at 0x7f51c5546f90> test_case = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_invalid_email> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_invalid_email> result = <TestCaseFunction test_invalid_with_invalid_email> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_invalid_email> method = <bound method TestIdentificationStage.test_invalid_with_invalid_email of <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_invalid_email>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_invalid_email> def test_invalid_with_invalid_email(self): """Test with invalid email (user doesn't exist) -> Will return to login form""" form_data = {"uid_field": self.user.email + "test"} response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), form_data, ) > self.assertEqual(response.status_code, 200) .../stages/identification/tests.py:341: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_invalid_email> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_invalid_email> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.identification.tests.TestIdentificationStage::test_invalid_no_fieldsStack Traces | 1.85s run time
self = <unittest.case._Outcome object at 0x7f51c6281240> test_case = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_no_fields> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_no_fields> result = <TestCaseFunction test_invalid_no_fields> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_no_fields> method = <bound method TestIdentificationStage.test_invalid_no_fields of <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_no_fields>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_no_fields> def test_invalid_no_fields(self): """Test invalid with username (no user fields are enabled)""" self.stage.user_fields = [] self.stage.save() form_data = {"uid_field": self.user.username} response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), form_data, ) > self.assertStageResponse( response, self.flow, component="ak-stage-identification", password_fields=False, primary_action="Log in", response_errors={ "non_field_errors": [{"code": "invalid", "string": "Failed to authenticate."}] }, show_source_labels=False, sources=[ { "challenge": { "component": "xak-flow-redirect", "to": ".../oauth/login/test/", }, "icon_url": ".../authentik/sources/default.svg", "name": "test", "promoted": False, } ], user_fields=[], ) .../stages/identification/tests.py:310: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_no_fields> response = <HttpChallengeResponse status_code=400, "application/json"> flow = <Flow: Flow JdRA4hRcB6 (jdra4hrcb6)>, user = None kwargs = {'component': 'ak-stage-identification', 'password_fields': False, 'primary_action': 'Log in', 'response_errors': {'non_field_errors': [{'code': 'invalid', 'string': 'Failed to authenticate.'}]}, ...} def assertStageResponse( self, response: HttpResponse, flow: Flow | None = None, user: User | None = None, **kwargs, ) -> dict[str, Any]: """Assert various attributes of a stage response""" > self.assertEqual(response.status_code, 200) .../flows/tests/__init__.py:30: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_no_fields> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_no_fields> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests::test_happy_pathStack Traces | 1.85s run time
self = <unittest.case._Outcome object at 0x7f9a474a7cb0> test_case = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_happy_path> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_happy_path> result = <TestCaseFunction test_happy_path> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_happy_path> method = <bound method AuthenticatorValidateStageEmailTests.test_happy_path of <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_happy_path>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_happy_path> def test_happy_path(self): """Test validator stage with valid code""" # Create a device for our user device = EmailDevice.objects.create( user=self.user, confirmed=True, stage=self.stage, email="[email protected]", ) # Short email for testing purposes # First identify the user self._identify_user() # Send the challenge > response = self._send_challenge(device) .../authenticator_validate/tests/test_email.py:84: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_happy_path> device = <EmailDevice: Email Device for 268> def _send_challenge(self, device): """Helper to send challenge for device""" response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), { "component": "ak-stage-authenticator-validate", "selected_challenge": { "device_class": "email", "device_uid": str(device.pk), "challenge": {}, "last_used": device.last_used.isoformat() if device.last_used else None, }, }, ) > self.assertEqual(response.status_code, 200) .../authenticator_validate/tests/test_email.py:67: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_happy_path> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_email.AuthenticatorValidateStageEmailTests testMethod=test_happy_path> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.identification.tests.TestIdentificationStage::test_invalid_with_usernameStack Traces | 1.86s run time
self = <unittest.case._Outcome object at 0x7f51c617f540> test_case = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_username> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_username> result = <TestCaseFunction test_invalid_with_username> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_username> method = <bound method TestIdentificationStage.test_invalid_with_username of <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_username>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_username> def test_invalid_with_username(self): """Test invalid with username (user exists but stage only allows email)""" form_data = {"uid_field": self.user.username} response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), form_data, ) > self.assertEqual(response.status_code, 200) .../stages/identification/tests.py:279: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_username> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_username> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests::test_stage_submit_twilioStack Traces | 1.93s run time
self = <unittest.case._Outcome object at 0x7f9a4746aac0> test_case = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit_twilio> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit_twilio> result = <TestCaseFunction test_stage_submit_twilio> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit_twilio> method = <bound method AuthenticatorSMSStageTests.test_stage_submit_twilio of <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit_twilio>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit_twilio> def test_stage_submit_twilio(self): """test stage (submit) (twilio)""" self.stage.account_sid = generate_id() self.stage.auth = generate_id() self.stage.from_number = generate_id() self.stage.save() self.client.get( reverse("authentik_flows:configure", kwargs={"stage_uuid": self.stage.stage_uuid}), ) response = self.client.get( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), ) self.assertStageResponse( response, self.flow, self.user, component="ak-stage-authenticator-sms", phone_number_required=True, ) number = generate_id() with Mocker() as mocker: mocker.post( ( "https://api.twilio.com/2010-04-01/Accounts/" f"{self.stage.account_sid}/Messages.json" ), json={}, ) response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), data={"component": "ak-stage-authenticator-sms", "phone_number": number}, ) > self.assertEqual(response.status_code, 200) .../stages/authenticator_sms/tests.py:124: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit_twilio> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_submit_twilio> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests::test_stage_hash_twiceStack Traces | 2.34s run time
self = <unittest.case._Outcome object at 0x7f9a47a88670> test_case = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_hash_twice> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_hash_twice> result = <TestCaseFunction test_stage_hash_twice> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_hash_twice> method = <bound method AuthenticatorSMSStageTests.test_stage_hash_twice of <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_hash_twice>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_hash_twice> def test_stage_hash_twice(self): """test stage (hash + duplicate)""" SMSDevice.objects.create( user=create_test_admin_user(), stage=self.stage, phone_number=hash_phone_number("foo"), ) self.stage.verify_only = True self.stage.save() self.client.get( reverse("authentik_flows:configure", kwargs={"stage_uuid": self.stage.stage_uuid}), ) response = self.client.get( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), ) self.assertStageResponse( response, self.flow, self.user, component="ak-stage-authenticator-sms", phone_number_required=True, ) sms_send_mock = MagicMock() with patch( "authentik.stages.authenticator_sms.models.AuthenticatorSMSStage.send", sms_send_mock, ): response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), data={"component": "ak-stage-authenticator-sms", "phone_number": "foo"}, ) > self.assertEqual(response.status_code, 200) .../stages/authenticator_sms/tests.py:349: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_hash_twice> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_sms.tests.AuthenticatorSMSStageTests testMethod=test_stage_hash_twice> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.identification.tests.TestIdentificationStage::test_invalid_with_passwordStack Traces | 2.47s run time
self = <unittest.case._Outcome object at 0x7f51d73ef690> test_case = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_password> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_password> result = <TestCaseFunction test_invalid_with_password> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_password> method = <bound method TestIdentificationStage.test_invalid_with_password of <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_password>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_password> def test_invalid_with_password(self): """Test with valid email and invalid password in single step""" pw_stage = PasswordStage.objects.create(name="password", backends=[BACKEND_INBUILT]) self.stage.password_stage = pw_stage self.stage.save() form_data = { "uid_field": self.user.email, "password": self.user.username + "test", } url = reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}) response = self.client.post(url, form_data) > self.assertStageResponse( response, self.flow, component="ak-stage-identification", password_fields=True, primary_action="Log in", response_errors={ "non_field_errors": [{"code": "invalid", "string": "Failed to authenticate."}] }, sources=[ { "challenge": { "component": "xak-flow-redirect", "to": ".../oauth/login/test/", }, "icon_url": ".../authentik/sources/default.svg", "name": "test", "promoted": False, } ], show_source_labels=False, user_fields=["email"], ) .../stages/identification/tests.py:81: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_password> response = <HttpChallengeResponse status_code=400, "application/json"> flow = <Flow: Flow wZWWko08CT (wzwwko08ct)>, user = None kwargs = {'component': 'ak-stage-identification', 'password_fields': True, 'primary_action': 'Log in', 'response_errors': {'non_field_errors': [{'code': 'invalid', 'string': 'Failed to authenticate.'}]}, ...} def assertStageResponse( self, response: HttpResponse, flow: Flow | None = None, user: User | None = None, **kwargs, ) -> dict[str, Any]: """Assert various attributes of a stage response""" > self.assertEqual(response.status_code, 200) .../flows/tests/__init__.py:30: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_password> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_invalid_with_password> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.enterprise.policies.unique_password.tests.test_flows.TestUniquePasswordPolicyFlow::test_prompt_dataStack Traces | 2.54s run time
self = <unittest.case._Outcome object at 0x7f9edfa97460> test_case = <authentik.enterprise.policies.unique_password.tests.test_flows.TestUniquePasswordPolicyFlow testMethod=test_prompt_data> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.enterprise.policies.unique_password.tests.test_flows.TestUniquePasswordPolicyFlow testMethod=test_prompt_data> result = <TestCaseFunction test_prompt_data> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.enterprise.policies.unique_password.tests.test_flows.TestUniquePasswordPolicyFlow testMethod=test_prompt_data> method = <bound method TestUniquePasswordPolicyFlow.test_prompt_data of <authentik.enterprise.policies.unique_password.tests.test_flows.TestUniquePasswordPolicyFlow testMethod=test_prompt_data>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.enterprise.policies.unique_password.tests.test_flows.TestUniquePasswordPolicyFlow testMethod=test_prompt_data> def test_prompt_data(self): """Test policy attached to a prompt stage""" # Test the policy directly from authentik.policies.types import PolicyRequest from authentik.stages.prompt.stage import PLAN_CONTEXT_PROMPT # Create a policy request with the reused password request = PolicyRequest(user=self.user) request.context[PLAN_CONTEXT_PROMPT] = {"password": self.REUSED_PASSWORD} # Test the policy directly result = self.policy.passes(request) # Verify that the policy fails (returns False) with the expected error message self.assertFalse(result.passing, "Policy should fail for reused password") self.assertEqual( result.messages[0], "This password has been used previously. Please choose a different one.", "Incorrect error message", ) # API-based testing approach: self.client.force_login(self.user) # Send a POST request to the flow executor with the reused password response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), {"password": self.REUSED_PASSWORD}, ) > self.assertStageResponse( response, self.flow, component="ak-stage-prompt", fields=[ { "choices": None, "field_key": "password", "label": "PASSWORD_LABEL", "order": 0, "placeholder": "PASSWORD_PLACEHOLDER", "initial_value": "", "required": True, "type": "password", "sub_text": "", } ], response_errors={ "non_field_errors": [ { "code": "invalid", "string": "This password has been used previously. " "Please choose a different one.", } ] }, ) .../unique_password/tests/test_flows.py:82: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.enterprise.policies.unique_password.tests.test_flows.TestUniquePasswordPolicyFlow testMethod=test_prompt_data> response = <HttpChallengeResponse status_code=400, "application/json"> flow = <Flow: Flow fGAfsVji30 (fgafsvji30)>, user = None kwargs = {'component': 'ak-stage-prompt', 'fields': [{'choices': None, 'field_key': 'password', 'initial_value': '', 'label': '...ld_errors': [{'code': 'invalid', 'string': 'This password has been used previously. Please choose a different one.'}]}} def assertStageResponse( self, response: HttpResponse, flow: Flow | None = None, user: User | None = None, **kwargs, ) -> dict[str, Any]: """Assert various attributes of a stage response""" > self.assertEqual(response.status_code, 200) .../flows/tests/__init__.py:30: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.enterprise.policies.unique_password.tests.test_flows.TestUniquePasswordPolicyFlow testMethod=test_prompt_data> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.enterprise.policies.unique_password.tests.test_flows.TestUniquePasswordPolicyFlow testMethod=test_prompt_data> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.identification.tests.TestIdentificationStage::test_recovery_flow_invalid_userStack Traces | 2.79s run time
self = <unittest.case._Outcome object at 0x7f51c5cda510> test_case = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_recovery_flow_invalid_user> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_recovery_flow_invalid_user> result = <TestCaseFunction test_recovery_flow_invalid_user> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_recovery_flow_invalid_user> method = <bound method TestIdentificationStage.test_recovery_flow_invalid_user of <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_recovery_flow_invalid_user>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_recovery_flow_invalid_user> def test_recovery_flow_invalid_user(self): """Test that an invalid user can proceed in a recovery flow""" self.flow.designation = FlowDesignation.RECOVERY self.flow.save() response = self.client.get( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), ) self.assertStageResponse( response, self.flow, component="ak-stage-identification", user_fields=["email"], password_fields=False, show_source_labels=False, primary_action="Continue", sources=[ { "challenge": { "component": "xak-flow-redirect", "to": ".../oauth/login/test/", }, "icon_url": ".../authentik/sources/default.svg", "name": "test", "promoted": False, } ], ) form_data = {"uid_field": generate_id()} url = reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}) response = self.client.post(url, form_data) > self.assertEqual(response.status_code, 200) .../stages/identification/tests.py:450: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_recovery_flow_invalid_user> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.identification.tests.TestIdentificationStage testMethod=test_recovery_flow_invalid_user> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.authenticator_webauthn.tests.TestAuthenticatorWebAuthnStage::test_register_restricted_device_type_denyStack Traces | 5.1s run time
self = <unittest.case._Outcome object at 0x7f9a58e46040> test_case = <authentik.stages.authenticator_webauthn.tests.TestAuthenticatorWebAuthnStage testMethod=test_register_restricted_device_type_deny> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_webauthn.tests.TestAuthenticatorWebAuthnStage testMethod=test_register_restricted_device_type_deny> result = <TestCaseFunction test_register_restricted_device_type_deny> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_webauthn.tests.TestAuthenticatorWebAuthnStage testMethod=test_register_restricted_device_type_deny> method = <bound method TestAuthenticatorWebAuthnStage.test_register_restricted_device_type_deny of <authentik.stages.authenticator_webauthn.tests.TestAuthenticatorWebAuthnStage testMethod=test_register_restricted_device_type_deny>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_webauthn.tests.TestAuthenticatorWebAuthnStage testMethod=test_register_restricted_device_type_deny> def test_register_restricted_device_type_deny(self): """Test registration with restricted devices (fail)""" webauthn_mds_import.send(force=True) self.stage.device_type_restrictions.set( WebAuthnDeviceType.objects.filter(description="YubiKey 5 Series") ) plan = FlowPlan(flow_pk=self.flow.pk.hex, bindings=[self.binding], markers=[StageMarker()]) plan.context[PLAN_CONTEXT_PENDING_USER] = self.user plan.context[PLAN_CONTEXT_WEBAUTHN_CHALLENGE] = b64decode( b"03Xodi54gKsfnP5I9VFfhaGXVVE2NUyZpBBXns/JI+x6V9RY2Tw2QmxRJkhh7174EkRazUntIwjMVY9bFG60Lw==" ) session = self.client.session session[SESSION_KEY_PLAN] = plan session.save() response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}), data={ "component": "ak-stage-authenticator-webauthn", "response": { "id": "kqnmrVLnDG-OwsSNHkihYZaNz5s", "rawId": "kqnmrVLnDG-OwsSNHkihYZaNz5s", "type": "public-key", "registrationClientExtensions": "{}", "response": { "clientDataJSON": ( "eyJ0eXBlIjoid2ViYXV0aG4uY3JlYXRlIiwiY2hhbGxlbmd" "lIjoiMDNYb2RpNTRnS3NmblA1STlWRmZoYUdYVlZFMk5VeV" "pwQkJYbnNfSkkteDZWOVJZMlR3MlFteFJKa2hoNzE3NEVrU" "mF6VW50SXdqTVZZOWJGRzYwTHciLCJvcmlnaW4iOiJodHRw" "Oi8vbG9jYWxob3N0OjkwMDAiLCJjcm9zc09yaWdpbiI6ZmFsc2V9" ), "attestationObject": ( "o2NmbXRkbm9uZWdhdHRTdG10oGhhdXRoRGF0YViYSZYN5Yg" "OjGh0NBcPZHZgW4_krrmihjLHmVzzuoMdl2NdAAAAAPv8MA" "cVTk7MjAtuAgVX170AFJKp5q1S5wxvjsLEjR5IoWGWjc-bp" "QECAyYgASFYIKtcZHPumH37XHs0IM1v3pUBRIqHVV_SE-Lq" "2zpJAOVXIlgg74Fg_WdB0kuLYqCKbxogkEPaVtR_iR3IyQFIJAXBzds" ), }, }, }, SERVER_NAME="localhost", SERVER_PORT="9000", ) > self.assertEqual(response.status_code, 200) .../stages/authenticator_webauthn/tests.py:188: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_webauthn.tests.TestAuthenticatorWebAuthnStage testMethod=test_register_restricted_device_type_deny> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_webauthn.tests.TestAuthenticatorWebAuthnStage testMethod=test_register_restricted_device_type_deny> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
authentik.stages.authenticator_validate.tests.test_webauthn.AuthenticatorValidateStageWebAuthnTests::test_validate_challenge_restrictedStack Traces | 5.27s run time
self = <unittest.case._Outcome object at 0x7f51c5b34750> test_case = <authentik.stages.authenticator_validate.tests.test_webauthn.AuthenticatorValidateStageWebAuthnTests testMethod=test_validate_challenge_restricted> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_webauthn.AuthenticatorValidateStageWebAuthnTests testMethod=test_validate_challenge_restricted> result = <TestCaseFunction test_validate_challenge_restricted> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:651: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_webauthn.AuthenticatorValidateStageWebAuthnTests testMethod=test_validate_challenge_restricted> method = <bound method AuthenticatorValidateStageWebAuthnTests.test_validate_challenge_restricted of <authentik.stages.authenticator_validate.tests.test_webauthn.AuthenticatorValidateStageWebAuthnTests testMethod=test_validate_challenge_restricted>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_webauthn.AuthenticatorValidateStageWebAuthnTests testMethod=test_validate_challenge_restricted> def test_validate_challenge_restricted(self): """Test webauthn authentication (restricted device type, failure)""" webauthn_mds_import.send(force=True).get_result() device = WebAuthnDevice.objects.create( user=self.user, public_key=( "pQECAyYgASFYIF-N4GvQJdTJMAmTOxFX9_boL00zBiSrP0DY9xvJl_FFIlggnyZloVSVofdJNTLMeMdjQHgW2Rzmd5_Xt5AWtNztcdo" ), credential_id="X43ga9Al1MkwCZM7EXD1r8Sxj7aXnNsuR013XM7he4kZ-GS9TaA-u3i36wsswjPm", sign_count=2, rp_id=generate_id(), device_type=WebAuthnDeviceType.objects.get( aaguid="2fc0579f-8113-47ea-b116-bb5a8db9202a" ), ) flow = create_test_flow() stage = AuthenticatorValidateStage.objects.create( name=generate_id(), not_configured_action=NotConfiguredAction.CONFIGURE, device_classes=[DeviceClasses.WEBAUTHN], ) stage.webauthn_allowed_device_types.set( WebAuthnDeviceType.objects.filter(description="YubiKey 5 Series") ) session = self.client.session plan = FlowPlan(flow_pk=flow.pk.hex) plan.append_stage(stage) plan.append_stage(UserLoginStage.objects.create(name=generate_id())) plan.context[PLAN_CONTEXT_PENDING_USER] = self.user plan.context[PLAN_CONTEXT_DEVICE_CHALLENGES] = [ { "device_class": device.__class__.__name__.lower().replace("device", ""), "device_uid": device.pk, "challenge": {}, "last_used": None, } ] plan.context[PLAN_CONTEXT_WEBAUTHN_CHALLENGE] = base64url_to_bytes( "aCC6ak_DP45xMH1qyxzUM5iC2xc4QthQb09v7m4qDBmY8FvWvhxFzSuFlDYQmclrh5fWS5q0TPxgJGF4vimcFQ" ) session[SESSION_KEY_PLAN] = plan session.save() response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": flow.slug}), data={ "webauthn": { "id": "X43ga9Al1MkwCZM7EXD1r8Sxj7aXnNsuR013XM7he4kZ-GS9TaA-u3i36wsswjPm", "rawId": "X43ga9Al1MkwCZM7EXD1r8Sxj7aXnNsuR013XM7he4kZ-GS9TaA-u3i36wsswjPm", "type": "public-key", "assertionClientExtensions": "{}", "response": { "clientDataJSON": ( "eyJ0eXBlIjoid2ViYXV0aG4uZ2V0IiwiY2hhbGxlbmdlIjoiYUNDN" "mFrX0RQNDV4TUgxcXl4elVNNWlDMnhjNFF0aFFiMDl2N200cURCbV" "k4RnZXdmh4RnpTdUZsRFlRbWNscmg1ZldTNXEwVFB4Z0pHRjR2aW1" "jRlEiLCJvcmlnaW4iOiJodHRwOi8vbG9jYWxob3N0OjkwMDAiLCJj" "cm9zc09yaWdpbiI6ZmFsc2V9" ), "signature": ( "MEQCIAHQCGfE_PX1z6mBDaXUNqK_NrllhXylNOmETUD3Khv9AiBTl" "rX3GDRj5OaOfTToOwUwAhtd74tu0T6DZAVHPb_hlQ==" ), "authenticatorData": "SZYN5YgOjGh0NBcPZHZgW4_krrmihjLHmVzzuoMdl2MFAAAABg==", "userHandle": None, }, } }, SERVER_NAME="localhost", SERVER_PORT="9000", ) > self.assertEqual(response.status_code, 200) .../authenticator_validate/tests/test_webauthn.py:404: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_webauthn.AuthenticatorValidateStageWebAuthnTests testMethod=test_validate_challenge_restricted> first = 400, second = 200, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.stages.authenticator_validate.tests.test_webauthn.AuthenticatorValidateStageWebAuthnTests testMethod=test_validate_challenge_restricted> first = 400, second = 200, msg = '400 != 200' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 400 != 200 .../hostedtoolcache/Python/3.13.9.............../x64/lib/python3.13/unittest/case.py:900: AssertionError
To view more test analytics, go to the Test Analytics Dashboard 📋 Got 3 mins? Take this short survey to help us improve Test Analytics.
Does this require special handling in the frontend/outposts?
probably, haven't tested yet