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())
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'])
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())
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'])
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'])
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())
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())
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'])