mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Merge branch 'develop' into feature
This commit is contained in:
@@ -14,7 +14,7 @@ from core.models import ObjectType
|
||||
from users.models import ObjectPermission
|
||||
from utilities.object_types import object_type_identifier
|
||||
from utilities.permissions import resolve_permission_type
|
||||
from .utils import extract_form_failures
|
||||
from .utils import DUMMY_CF_DATA, extract_form_failures
|
||||
|
||||
__all__ = (
|
||||
'ModelTestCase',
|
||||
@@ -169,8 +169,12 @@ class ModelTestCase(TestCase):
|
||||
model_dict = self.model_to_dict(instance, fields=fields, api=api)
|
||||
|
||||
# Omit any dictionary keys which are not instance attributes or have been excluded
|
||||
relevant_data = {
|
||||
model_data = {
|
||||
k: v for k, v in data.items() if hasattr(instance, k) and k not in exclude
|
||||
}
|
||||
|
||||
self.assertDictEqual(model_dict, relevant_data)
|
||||
self.assertDictEqual(model_dict, model_data)
|
||||
|
||||
# Validate any custom field data, if present
|
||||
if getattr(instance, 'custom_field_data', None):
|
||||
self.assertDictEqual(instance.custom_field_data, DUMMY_CF_DATA)
|
||||
|
Reference in New Issue
Block a user