From de72ac97cb67dc3030d8e72a7196968888f4dd52 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 30 Jul 2025 12:44:40 -0400 Subject: [PATCH] Ignore private fields when constructing test GraphQL requests --- netbox/utilities/testing/api.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/netbox/utilities/testing/api.py b/netbox/utilities/testing/api.py index 12e38a27f..9de3c43f8 100644 --- a/netbox/utilities/testing/api.py +++ b/netbox/utilities/testing/api.py @@ -470,6 +470,9 @@ class APIViewTestCases: elif type(field.type) is StrawberryOptional and type(field.type.of_type) is LazyType: fields_string += f'{field.name} {{ id }}\n' elif hasattr(field, 'is_relation') and field.is_relation: + # Ignore private fields + if field.name.startswith('_'): + continue # Note: StrawberryField types do not have is_relation fields_string += f'{field.name} {{ id }}\n' elif inspect.isclass(field.type) and issubclass(field.type, IPAddressFamilyType):