def test_send_sms_health_facility_changed(self):
        p = self.create_patient(status='S')
        p.save()

        tasks.sms_func = MagicMock()
        hf = HealthFacility()
        hf.name = 'HF_2'
        self.health_facility = hf
        hf.save()
        p.health_facility = hf
        p.save()

        self.assertEqual(tasks.sms_func.call_count, 1)
        self.assert_calls(tasks.sms_func, ['location'])
    def test_send_sms_health_facility_changed(self):
        p = self.create_patient(status='S')
        p.save()

        tasks.sms_func = MagicMock()
        hf = HealthFacility()
        hf.name = 'HF_2'
        self.health_facility = hf
        hf.save()
        p.health_facility = hf
        p.save()

        self.assertEqual(tasks.sms_func.call_count, 1)
        self.assert_calls(tasks.sms_func, ['location'])
 def create_patient(self, status):
     hf = HealthFacility()
     hf.name = 'HF'
     hf.save()
     self.health_facility = hf
     patient = Patient()
     patient.health_facility = hf
     if status:
         patient.status = status
     patient.contact_phone_number = self.contact_phone_number
     patient.first_name = self.first_name
     patient.last_name = self.last_name
     self.info_code = patient.info_code
     self.patient = patient
     return patient
 def create_patient(self, status):
     hf = HealthFacility()
     hf.name = 'HF'
     hf.save()
     self.health_facility = hf
     patient = Patient()
     patient.health_facility = hf
     if status:
         patient.status = status
     patient.contact_phone_number = self.contact_phone_number
     patient.first_name = self.first_name
     patient.last_name = self.last_name
     self.info_code = patient.info_code
     self.patient = patient
     return patient