def test_validate_university(self): form = HealthCheckProfileForm() tracker = Tracker( "27820001001", {"destination_province": "ec"}, {}, [], False, None, {}, "action_listen", ) dispatcher = CollectingDispatcher() response = form.validate_university("afda", dispatcher, tracker, {}) self.assertEqual( response, { "university": "afda", "university_list": "\n".join( [ "*1.* AFDA", "*2.* STADIO AFDA", "*3.* Ikhala", "*4.* MANCOSA", "*5.* Damelin", ] ), }, )
def test_validate_destination_province(self): form = HealthCheckProfileForm() tracker = Tracker("27820001001", {}, {}, [], False, None, {}, "action_listen") dispatcher = CollectingDispatcher() response = form.validate_destination_province("1", dispatcher, tracker, {}) self.assertEqual( response, {"destination_province": "ec"}, )
def test_slot_mappings(self): """ Ensures that the additional school fields are in the slot mappings """ form = HealthCheckProfileForm() mappings = form.slot_mappings() self.assertIn("first_name", mappings) self.assertIn("last_name", mappings) self.assertIn("destination", mappings) self.assertIn("reason", mappings) self.assertIn("destination_province", mappings) self.assertIn("university", mappings) self.assertIn("vaccine_uptake", mappings)
def test_validate_university_confirm(self): form = HealthCheckProfileForm() tracker = Tracker( "27820001001", {"destination_province": "ec", "university": "afda"}, {}, [], False, None, {}, "action_listen", ) dispatcher = CollectingDispatcher() response = form.validate_university_confirm("1", dispatcher, tracker, {}) self.assertEqual( response, {"university_confirm": "AFDA", "campus_list": "*1.* Cenral"}, )
def test_validate_vaccine_uptake(self, mock_utter): form = HealthCheckProfileForm() tracker = Tracker( "27820001001", {"destination_province": "ec", "university": "afda", "campus": "Cenral"}, {}, [], False, None, {}, "action_listen", ) dispatcher = CollectingDispatcher() response = form.validate_vaccine_uptake("3", dispatcher, tracker, {}) self.assertEqual( response, {"vaccine_uptake": "NOT"}, ) mock_utter.assert_called_once_with(template="utter_not_vaccinated")
def test_validate_reason(self): form = HealthCheckProfileForm() tracker = Tracker("27820001001", {}, {}, [], False, None, {}, "action_listen") dispatcher = CollectingDispatcher() response = form.validate_reason("student", dispatcher, tracker, {}) self.assertEqual(response, {"reason": "student"})