Skip to content

Commit

Permalink
Merge pull request #703 from praekeltfoundation/survey_invite_not_int…
Browse files Browse the repository at this point in the history
…erested_update

set survey started to not interested
  • Loading branch information
Hlamallama authored Nov 9, 2023
2 parents 5504cb5 + 528de68 commit 8818750
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions yal/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,15 @@ async def process_message(self, message):
)
else:
self.state_name = EndlineTermsApplication.NO_CONSENT_STATE

data = {
"endline_survey_started": "not_interested",
}
error = await rapidpro.update_profile(
whatsapp_id, data, self.user.metadata
)
if error:
return await self.go_to_state("state_error")
else:
self.state_name = EndlineTermsApplication.START_STATE

Expand Down
7 changes: 7 additions & 0 deletions yal/tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,13 @@ async def test_endline_survey_not_interested_keywords(
await tester.user_input("I'm not interested")
tester.assert_state("state_no_consent")

tester.assert_metadata("endline_survey_started", "not_interested")

request = rapidpro_mock.tstate.requests[1]
assert json.loads(request.body.decode("utf-8")) == {
"fields": {"endline_survey_started": "not_interested"}
}


@pytest.mark.asyncio
async def test_tracked_keywords_saved(
Expand Down

0 comments on commit 8818750

Please sign in to comment.