Skip to content

Commit

Permalink
Merge pull request #662 from praekeltfoundation/endline_questions
Browse files Browse the repository at this point in the history
fix 2 added question
  • Loading branch information
Hlamallama authored Aug 14, 2023
2 parents 145e508 + 467eac6 commit 9adfd19
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion yal/endline_terms_and_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ async def state_household_number_of_people(self):

async def next_state(choice: Choice):
if choice.value == "eight_more":
return "state_household_number_of_people_more"
return "state_household_number_of_people_eight_or_more"
return "state_submit_terms_and_conditions_endline"

return WhatsAppListState(
Expand Down
18 changes: 12 additions & 6 deletions yal/tests/test_endline_terms_and_condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ async def test_state_monthly_household_income_endline(tester: AppTester, rapidpr
)
tester.assert_message(message)

tester.assert_message(message)


@pytest.mark.asyncio
async def test_state_accept_consent_reminder(tester: AppTester, rapidpro_mock):
Expand Down Expand Up @@ -144,19 +142,27 @@ async def test_state_household_number_of_people(tester: AppTester, rapidpro_mock
@pytest.mark.asyncio
async def test_state_household_number_of_people_more(tester: AppTester, rapidpro_mock):
tester.setup_state("state_household_number_of_people")
await tester.user_input("7")
message = "\n".join(["◼️◽️◽️◽️", "-----", "", "*I'm my own boss.* 😎"])
await tester.user_input("8")
message = "\n".join(
[
"*Okay - you said there are 8 or more people in your household.*",
"*How many people (including yourself) live in the household now?"
" Don’t forget to include babies.*",
"(If you’re unsure - this counts as anyone sleeping the house"
"4 nights in the past week).",
]
)

tester.assert_message(message)
tester.assert_state("state_survey_question")
tester.assert_state("state_household_number_of_people_eight_or_more")


@pytest.mark.asyncio
async def test_state_household_number_of_people_eight_or_more(
tester: AppTester, rapidpro_mock
):
tester.setup_state("state_household_number_of_people_eight_or_more")
await tester.user_input("1")
await tester.user_input("5")
message = "\n".join(["◼️◽️◽️◽️", "-----", "", "*I'm my own boss.* 😎"])

tester.assert_message(message)
Expand Down

0 comments on commit 9adfd19

Please sign in to comment.