def test_form_not_valid_when_other_ids_duplicate_main_id(self): experiment = ExperimentFactory.create() form = NormandyIdForm( self.request, instance=experiment, data={"normandy_id": "4343", "other_normandy_ids": "4343"}, ) self.assertFalse(form.is_valid())
def test_form_valid_when_other_ids_formatted_correctly(self): experiment = ExperimentFactory.create() form = NormandyIdForm( self.request, instance=experiment, data={"normandy_id": "4343", "other_normandy_ids": "4323, 5671"}, ) self.assertTrue(form.is_valid())
def test_form_not_valid_with_bad_other_ids(self): experiment = ExperimentFactory.create() form = NormandyIdForm( self.request, instance=experiment, data={"normandy_id": "4343", "other_normandy_ids": "434, aaa"}, ) self.assertFalse(form.is_valid())
def test_form_changelog_has_message(self): experiment = ExperimentFactory.create() form = NormandyIdForm( self.request, instance=experiment, data={"normandy_id": "4343", "other_normandy_ids": "443"}, ) self.assertTrue(form.is_valid()) form.save() self.assertTrue(experiment.changes.latest().message, "Recipe ID(s) Added")