Example #1
0
 def test_invalid_batch_choices(self):
     indicator_filter_form = IndicatorFilterForm(
         data={
             'survey': str(self.survey.id),
             'batch': 'ayoyoyooooooo'
         })
     self.assertTrue(indicator_filter_form.is_valid())
Example #2
0
    def test_only_survey_batches_are_allowed(self):
        bacth_id_not_belongin_got_self_survey = str(self.batch_3.id)
        data = {'survey':str(self.survey.id), 'batch':bacth_id_not_belongin_got_self_survey}
        indicator_filter_form = IndicatorFilterForm(data=data)

        self.assertFalse(indicator_filter_form.is_valid())
        self.assertEqual(['Select a valid choice. %s is not one of the available choices.'%data['batch']],indicator_filter_form.errors['batch'])
Example #3
0
 def test_only_survey_batches_are_allowed(self):
     bacth_id_not_belongin_got_self_survey = str(self.batch_3.id)
     data = {
         'survey': str(self.survey.id),
         'batch': bacth_id_not_belongin_got_self_survey
     }
     indicator_filter_form = IndicatorFilterForm(data=data)
     self.assertTrue(indicator_filter_form.is_valid())
Example #4
0
 def test_invalid_survey_choices(self):
     indicator_filter_form = IndicatorFilterForm(data={
         'survey': 'ayoyoyoyoooo',
         'batch': str(self.batch.id)
     })
     self.assertFalse(indicator_filter_form.is_valid())
     self.assertEqual([
         'Select a valid choice. ayoyoyoyoooo is not one of the available choices.'
     ], indicator_filter_form.errors['survey'])
Example #5
0
    def test_only_survey_batches_are_allowed(self):
        bacth_id_not_belongin_got_self_survey = str(self.batch_3.id)
        data = {
            'survey': str(self.survey.id),
            'batch': bacth_id_not_belongin_got_self_survey
        }
        indicator_filter_form = IndicatorFilterForm(data=data)

        self.assertFalse(indicator_filter_form.is_valid())
        self.assertEqual([
            'Select a valid choice. %s is not one of the available choices.' %
            data['batch']
        ], indicator_filter_form.errors['batch'])
Example #6
0
 def test_only_survey_batches_are_allowed(self):
     bacth_id_not_belongin_got_self_survey = str(self.batch_3.id)
     data = {'survey': str(self.survey.id),
             'batch': bacth_id_not_belongin_got_self_survey}
     indicator_filter_form = IndicatorFilterForm(data=data)
     self.assertTrue(indicator_filter_form.is_valid())
Example #7
0
 def test_invalid_batch_choices(self):
     indicator_filter_form = IndicatorFilterForm(
         data={'survey': str(self.survey.id), 'batch': 'ayoyoyooooooo'})
     self.assertTrue(indicator_filter_form.is_valid())
Example #8
0
 def test_invalid_survey_choices(self):
     indicator_filter_form = IndicatorFilterForm(
         data={'survey': 'ayoyoyoyoooo', 'batch': str(self.batch.id)})
     self.assertFalse(indicator_filter_form.is_valid())
     self.assertEqual(['Select a valid choice. ayoyoyoyoooo is not one of the available choices.'],
                      indicator_filter_form.errors['survey'])