From 8789625f7910d5b41af594a7d90eb3e5fd9e472b Mon Sep 17 00:00:00 2001 From: Hlamalani Date: Mon, 20 Nov 2023 12:52:53 +0200 Subject: [PATCH] add next step after endline not interested --- yal/assessments.py | 5 ++++- yal/tests/test_assessments.py | 13 +++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/yal/assessments.py b/yal/assessments.py index 0d546b89..2c1d99c2 100644 --- a/yal/assessments.py +++ b/yal/assessments.py @@ -470,7 +470,10 @@ async def state_not_interested(self): Choice("menu", self._("Go to the menu")), Choice("aaq", self._("Ask a question")), ], - next=None, + next={ + "menu": "state_pre_mainmenu", + "aaq": AAQApplication.START_STATE, + }, error=self._(get_generic_error()), ) diff --git a/yal/tests/test_assessments.py b/yal/tests/test_assessments.py index fd7eccfd..16ae0cff 100644 --- a/yal/tests/test_assessments.py +++ b/yal/tests/test_assessments.py @@ -622,3 +622,16 @@ async def test_state_assessment_later_submit_endline(tester: AppTester): tester.setup_state("state_assessment_later_submit") tester.assert_metadata("assessment_reminder_name", "locus_of_control_endline") + + +@pytest.mark.asyncio +async def test_whatsapp_menu_after_not_interested(tester: AppTester, rapidpro_mock): + tester.user.metadata["terms_accepted"] = "True" + tester.user.metadata["onboarding_completed"] = "True" + tester.user.metadata["endline_survey_started"] = "not_interested" + + tester.setup_state("state_not_interested") + + await tester.user_input("menu") + + tester.assert_state("state_mainmenu")