Update test

This commit is contained in:
Jeremy Stretch
2026-01-05 11:00:54 -05:00
parent bc26529be8
commit 6ed6da49d9

View File

@@ -1506,19 +1506,18 @@ class CustomFieldModelTest(TestCase):
def test_invalid_data(self):
"""
Setting custom field data for a non-applicable (or non-existent) CustomField should raise a ValidationError.
Any invalid or stale custom field data should be removed from the instance.
"""
site = Site(name='Test Site', slug='test-site')
# Set custom field data
site.custom_field_data['foo'] = 'abc'
site.custom_field_data['bar'] = 'def'
with self.assertRaises(ValidationError):
site.clean()
del site.custom_field_data['bar']
site.clean()
self.assertIn('foo', site.custom_field_data)
self.assertNotIn('bar', site.custom_field_data)
def test_missing_required_field(self):
"""
Check that a ValidationError is raised if any required custom fields are not present.