Skip to content

Commit 6ed6da4

Browse files
committed
Update test
1 parent bc26529 commit 6ed6da4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

netbox/extras/tests/test_customfields.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,19 +1506,18 @@ def test_cf_data(self):
15061506

15071507
def test_invalid_data(self):
15081508
"""
1509-
Setting custom field data for a non-applicable (or non-existent) CustomField should raise a ValidationError.
1509+
Any invalid or stale custom field data should be removed from the instance.
15101510
"""
15111511
site = Site(name='Test Site', slug='test-site')
15121512

15131513
# Set custom field data
15141514
site.custom_field_data['foo'] = 'abc'
15151515
site.custom_field_data['bar'] = 'def'
1516-
with self.assertRaises(ValidationError):
1517-
site.clean()
1518-
1519-
del site.custom_field_data['bar']
15201516
site.clean()
15211517

1518+
self.assertIn('foo', site.custom_field_data)
1519+
self.assertNotIn('bar', site.custom_field_data)
1520+
15221521
def test_missing_required_field(self):
15231522
"""
15241523
Check that a ValidationError is raised if any required custom fields are not present.

0 commit comments

Comments
 (0)