Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Hlamallama committed Aug 8, 2023
1 parent d51cd4c commit deeead8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 153 deletions.
101 changes: 1 addition & 100 deletions yal/endline_terms_and_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ async def state_no_consent(self):
question = self._(
"\n".join(
[
"That's completely okay, there are no consequences to not taking "
"That's completely okay, there are no consequences to not taking ,"
"part in this study. Please enjoy the BWise tool and stay safe. "
"If you change your mind, please send *Answer* to this number",
]
Expand Down Expand Up @@ -193,105 +193,6 @@ async def state_monthly_household_income_endline(self):
]
)
)
return ChoiceState(
self,
question=question,
error=error,
choices=choices,
next="state_household_number_of_people",
)

async def state_household_number_of_people(self):
choices = [
Choice("one", self._("Just me")),
Choice("two", self._("Two people")),
Choice("three", self._("Three people")),
Choice("four", self._("Four people")),
Choice("five", self._("Five people")),
Choice("six", self._("Six people")),
Choice("seven", self._("Seven people")),
Choice("eight_more", self._("Eight or more")),
Choice("rather", "Rather not say"),
Choice("skip_question", self._("Skip question")),
]

question = self._(
"\n".join(
[
"*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).",
]
)
)
error = self._(
"\n".join(
[
"*Oops. We did not understand your answer*",
"Please respond with the *number* of an option below",
"",
"How many people (including yourself) live in the household now?",
]
)
)

next = (
{
"one": "state_submit_terms_and_conditions_endline",
"two": "state_submit_terms_and_conditions_endline",
"three": "state_submit_terms_and_conditions_endline",
"four": "state_submit_terms_and_conditions_endline",
"five": "state_submit_terms_and_conditions_endline",
"six": "state_submit_terms_and_conditions_endline",
"seven": "state_submit_terms_and_conditions_endline",
"eight_more": "state_household_number_of_people_more",
},
)
return ChoiceState(
self,
question=question,
error=error,
choices=choices,
next=next,
)

async def state_household_number_of_people_more(self):
choices = [
Choice("eight", self._("Including me")),
Choice("nine", self._("Nine people")),
Choice("ten", self._("Ten people")),
Choice("eleven", self._("Eleven people")),
Choice("twelve", self._("Twelve people")),
Choice("thirteen", self._("Thirteen people")),
Choice("fourteen", self._("Fourteen people")),
Choice("fifteen", self._("Fifteen people")),
Choice("rather", "Rather not say"),
Choice("skip_question", self._("Skip question")),
]

question = self._(
"\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).",
]
)
)
error = self._(
"\n".join(
[
"*Oops. We did not understand your answer*",
"Please respond with the *number* of an option below",
"",
"How many people (including yourself) live in the household now?",
]
)
)
return ChoiceState(
self,
question=question,
Expand Down
4 changes: 1 addition & 3 deletions yal/tests/states_dictionary.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
| state_reschedule_assessment_reminder | | | | Schedules the assessment reminders |
| state_remind_tomorrow | TRUE | Text | TRUE | Lets the user know we will remind them tomorrow, asks the user if they would like to go to the mainmenu |
| state_reminder_not_interested | True | Text | TRUE | Lets the user know that they will no longer be prt of the study |
| state_survey_validation | True | Text | TRUE | endline survey catch all validation |
| state_survey_validation | True | Text | TRUE | endline survey catcha |


### Service finder flow
Expand Down Expand Up @@ -612,8 +612,6 @@
| state_platform_review_endline | False | Text | Review the platform |
| state_relationship_status_endline | False | Text | endline relationship status |
| state_submit_terms_and_conditions_endline | False | Text | Endline Terms and Condition Submit |
| state_household_number_of_people | False | Text | Endline number of peopleing living in househould |
| state_household_number_of_people_more | False | Text | Endline number of peopleing living in househould if more than 8 people |
| state_not_interested | False | Text | Endline Survery not interested |
| state_monthly_household_income_endline | False | Text | Endline household income |
| state_start_terms | False | Text | Endline terms and conditions |
Expand Down
6 changes: 5 additions & 1 deletion yal/tests/surveys/test_endline.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,11 @@ async def test_endline_survey_validation(tester: AppTester, rapidpro_mock):
[reply] = await app.process_message(msg)

assert user.state.name == "state_survey_validation"
assert reply.content in GENERIC_ERROR_OPTIONS
error_content = reply.content
if "Umm.." in error_content:
error_content = error_content.replace("🤖", "[persona_emoji]")

assert error_content in GENERIC_ERROR_OPTIONS


@pytest.mark.asyncio
Expand Down
50 changes: 1 addition & 49 deletions yal/tests/test_endline_terms_and_condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async def test_state_terms_decline(tester: AppTester, rapidpro_mock):
tester.assert_state("state_no_consent")
message = "\n".join(
[
"That's completely okay, there are no consequences to not taking "
"That's completely okay, there are no consequences to not taking ,"
"part in this study. Please enjoy the BWise tool and stay safe. "
"If you change your mind, please send *Answer* to this number",
]
Expand All @@ -78,57 +78,9 @@ async def test_state_monthly_household_income_endline(tester: AppTester, rapidpr
tester.setup_state("state_monthly_household_income_endline")
await tester.user_input("1")

tester.assert_state("state_household_number_of_people")

message = "\n".join(
[
"*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).",
"1. Just me",
"2. Two people",
"3. Three people",
"4. Four people",
"5. Five people",
"6. Six people",
"7. Seven people",
"8. Eight or more",
"9. Rather not say",
"10. Skip question",
]
)
tester.assert_message(message)


# @pytest.mark.asyncio
# async def test_state_household_number_of_people(tester: AppTester, rapidpro_mock):
# tester.setup_state("state_household_number_of_people")
# await tester.user_input("2")

# tester.assert_state("state_submit_terms_and_conditions_endline")


# @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("8")

# tester.assert_state("state_household_number_of_people_more")


@pytest.mark.asyncio
async def test_state_household_number_of_people_more(tester: AppTester, rapidpro_mock):
tester.setup_state("state_household_number_of_people_more")
await tester.user_input("1")

tester.assert_state("state_survey_question")

message = "\n".join(["◼️◽️◽️◽️", "-----", "", "*I'm my own boss.* 😎"])

tester.assert_message(message)


Expand Down

0 comments on commit deeead8

Please sign in to comment.