diff --git a/passbook/api/v2/urls.py b/passbook/api/v2/urls.py index 4cf282a98..f00e6f636 100644 --- a/passbook/api/v2/urls.py +++ b/passbook/api/v2/urls.py @@ -37,6 +37,7 @@ from passbook.stages.invitation.api import InvitationStageViewSet, InvitationVie from passbook.stages.otp.api import OTPStageViewSet from passbook.stages.password.api import PasswordStageViewSet from passbook.stages.prompt.api import PromptStageViewSet, PromptViewSet +from passbook.stages.user_delete.api import UserDeleteStageViewSet from passbook.stages.user_login.api import UserLoginStageViewSet from passbook.stages.user_logout.api import UserLogoutStageViewSet from passbook.stages.user_write.api import UserWriteStageViewSet @@ -88,6 +89,7 @@ router.register("stages/otp", OTPStageViewSet) router.register("stages/password", PasswordStageViewSet) router.register("stages/prompt/stages", PromptStageViewSet) router.register("stages/prompt/prompts", PromptViewSet) +router.register("stages/user_delete", UserDeleteStageViewSet) router.register("stages/user_login", UserLoginStageViewSet) router.register("stages/user_logout", UserLogoutStageViewSet) router.register("stages/user_write", UserWriteStageViewSet) diff --git a/passbook/stages/user_delete/stage.py b/passbook/stages/user_delete/stage.py index aeed299ce..1547cf944 100644 --- a/passbook/stages/user_delete/stage.py +++ b/passbook/stages/user_delete/stage.py @@ -14,7 +14,7 @@ LOGGER = get_logger() class UserDeleteStageView(FormView, AuthenticationStage): - """Finalise Enrollment flow by creating a user object.""" + """Finalise unenrollment flow by deleting the user object.""" form_class = UserDeleteForm diff --git a/passbook/stages/user_delete/tests.py b/passbook/stages/user_delete/tests.py index d4aeb2f25..88ff49479 100644 --- a/passbook/stages/user_delete/tests.py +++ b/passbook/stages/user_delete/tests.py @@ -26,6 +26,21 @@ class TestUserDeleteStage(TestCase): self.stage = UserDeleteStage.objects.create(name="delete") FlowStageBinding.objects.create(flow=self.flow, stage=self.stage, order=2) + def test_no_user(self): + """Test without user set""" + plan = FlowPlan(flow_pk=self.flow.pk.hex, stages=[self.stage]) + session = self.client.session + session[SESSION_KEY_PLAN] = plan + session.save() + + response = self.client.get( + reverse( + "passbook_flows:flow-executor", kwargs={"flow_slug": self.flow.slug} + ) + ) + self.assertEqual(response.status_code, 302) + self.assertEqual(response.url, reverse("passbook_flows:denied")) + def test_user_delete_get(self): """Test Form render""" plan = FlowPlan(flow_pk=self.flow.pk.hex, stages=[self.stage])