diff --git a/authentik/stages/consent/tests.py b/authentik/stages/consent/tests.py index f1b10bc86..25f99d30a 100644 --- a/authentik/stages/consent/tests.py +++ b/authentik/stages/consent/tests.py @@ -1,7 +1,6 @@ """consent tests""" from time import sleep -from django.http.response import HttpResponse from django.urls import reverse from django.utils.encoding import force_str from rest_framework.test import APITestCase @@ -41,12 +40,14 @@ class TestConsentStage(APITestCase): session = self.client.session session[SESSION_KEY_PLAN] = plan session.save() - response: HttpResponse = self.client.post( + response = self.client.post( reverse("authentik_api:flow-executor", kwargs={"flow_slug": flow.slug}), {}, ) + # pylint: disable=no-member self.assertEqual(response.status_code, 200) self.assertJSONEqual( + # pylint: disable=no-member force_str(response.content), { "component": "xak-flow-redirect", diff --git a/authentik/stages/email/management/commands/test_email.py b/authentik/stages/email/management/commands/test_email.py index a2c36d545..3700d53c1 100644 --- a/authentik/stages/email/management/commands/test_email.py +++ b/authentik/stages/email/management/commands/test_email.py @@ -16,7 +16,11 @@ class Command(BaseCommand): # pragma: no cover """Send a test-email with global settings""" delete_stage = False if options["stage"]: - stage = EmailStage.objects.get(name=options["stage"]) + stages = EmailStage.objects.filter(name=options["stage"]) + if not stages.exists(): + print(f"Stage '{options['stage']}' does not exist") + return + stage = stages.first() else: stage = EmailStage.objects.create( name=f"temp-global-stage-{uuid4()}", use_global_settings=True