def test_no_contraceptive_initiated_but_listed(self):
     """Test participant uses contraceptives but none listed"""
     self.data['is_contraceptive_initiated'] = NO
     form = MaternalSrhForm(data=self.data)
     self.assertIn(
         'If you have not initiated contraceptive method, please provide reason.',
         form.errors.get('__all__'))
 def test_no_contraceptive_reason_given(self):
     self.data['is_contraceptive_initiated'] = NO
     self.data['reason_not_initiated'] = None
     form = MaternalSrhForm(data=self.data)
     self.assertIn(
         "If you have not initiated contraceptive method, please provide reason.",
         form.errors.get('__all__') or [])
 def test_unseen_no_reason(self):
     """Test participant not seen at clinic but reason not provided"""
     self.data['seen_at_clinic'] = NO
     form = MaternalSrhForm(data=self.data)
     self.data['reason_unseen_clinic'] = None
     self.assertIn(
         'If you have not been seen in that clinic since your last visit with us, why not?',
         form.errors.get('__all__'))
 def test_seen_at_clinic_dwta(self):
     """Test does not want to answer with reason unseen given"""
     self.data['seen_at_clinic'] = 'DWTA'
     self.data['reason_unseen_clinic'] = 'not_sexually_active'
     form = MaternalSrhForm(data=self.data)
     self.assertIn(
         'If participant does not want to answer, the questionnaire is complete.',
         form.errors.get('__all__'))
 def test_init_no_contraceptive_given(self):
     """Test contraceptive initiated but no reason given"""
     self.data['seen_at_clinic'] = YES
     self.data['is_contraceptive_initiated'] = YES
     self.data['contr'] = None
     form = MaternalSrhForm(data=self.data)
     self.assertIn(
         'You indicated that contraceptives were initiated, please give a valid contraceptive.',
         form.errors.get('__all__') or [])
 def test_reason_unseen_clinic_not_tried(self):
     """Test not seen at clinic and reason unseen at clinic not tried"""
     self.data['seen_at_clinic'] = NO
     self.data['reason_unseen_clinic'] = 'not_tried'
     self.data['is_contraceptive_initiated'] = YES
     form = MaternalSrhForm(data=self.data)
     self.assertIn(
         'If participant answered I have not yet sought the clinic, the questionnaire is complete.',
         form.errors.get('__all__'))
 def test_contraceptive_dwta(self):
     """Test test dont want to answer (DWTA) at contraceptive initiation"""
     self.data['seen_at_clinic'] = YES
     self.data['is_contraceptive_initiated'] = 'DWTA'
     self.data['reason_not_initiated'] = 'no_options'
     form = MaternalSrhForm(data=self.data)
     self.assertIn(
         'Participant does not want to answer the question on contraceptive initiation, '
         'the questionnaire is complete.',
         form.errors.get('__all__') or [])
 def test_init_reason_not_initiated_given(self):
     """Test contraceptive initiated and reason not initiated not given"""
     self.data['seen_at_clinic'] = YES
     self.data['is_contraceptive_initiated'] = YES
     self.data['contr'] = 'Condom'
     self.data['reason_not_initiated'] = 'no_options'
     form = MaternalSrhForm(data=self.data)
     self.assertIn(
         'You indicated that contraceptives were initiated, please give a valid contraceptive.',
         form.errors.get('__all__') or [])
 def test_srh_srh_form_valid3(self):
     """Asserts if have not initiated contraceptive methods raises."""
     self.data['seen_at_clinic'] = NO
     self.data['reason_unseen_clinic'] = 'not_sexually_active'
     self.data['is_contraceptive_initiated'] = NO
     contraceptives = Contraceptives.objects.exclude(
         name__icontains='other').first()
     self.data['contr'] = [contraceptives.id]
     form = MaternalSrhForm(data=self.data)
     self.assertIn(
         'If you have not initiated contraceptive method, please provide reason.',
         form.errors.get('__all__') or [])