14467 update tests

This commit is contained in:
Arthur 2023-12-11 11:10:41 -08:00
parent 855c32a635
commit ff343dc031

View File

@ -76,7 +76,6 @@ class CustomFieldTestCase(ViewTestCases.PrimaryObjectViewTestCase):
class CustomFieldChoiceSetTestCase(ViewTestCases.PrimaryObjectViewTestCase): class CustomFieldChoiceSetTestCase(ViewTestCases.PrimaryObjectViewTestCase):
model = CustomFieldChoiceSet model = CustomFieldChoiceSet
validation_excluded_fields = ('extra_choices',)
@classmethod @classmethod
def setUpTestData(cls): def setUpTestData(cls):
@ -120,30 +119,12 @@ class CustomFieldChoiceSetTestCase(ViewTestCases.PrimaryObjectViewTestCase):
'description': 'New description', 'description': 'New description',
} }
# These are here as extra_choices field splits on colon, but is returned # This is here as extra_choices field splits on colon, but is returned
# from DB as comma separated. So we exclude them in validation_excluded_fields # from DB as comma separated.
# but test they are actually set correctly here. def assertInstanceEqual(self, instance, data, exclude=None, api=False):
def _check_extra_choices_data(self): if 'extra_choices' in data:
instance = self._get_queryset().last() data['extra_choices'] = data['extra_choices'].replace(':', ',')
form_data = self.form_data return super().assertInstanceEqual(instance, data, exclude, api)
form_data['extra_choices'] = form_data['extra_choices'].replace(':', ',')
self.assertInstanceEqual(instance, form_data)
def test_create_object_with_constrained_permission(self):
super().test_create_object_with_constrained_permission()
self._check_extra_choices_data()
def test_create_object_with_permission(self):
super().test_create_object_with_permission()
self._check_extra_choices_data()
def test_edit_object_with_constrained_permission(self):
super().test_edit_object_with_constrained_permission()
self._check_extra_choices_data()
def test_edit_object_with_permission(self):
super().test_edit_object_with_permission()
self._check_extra_choices_data()
class CustomLinkTestCase(ViewTestCases.PrimaryObjectViewTestCase): class CustomLinkTestCase(ViewTestCases.PrimaryObjectViewTestCase):