1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #11851: Add family field to IPAddress queries in GraphQL (#11870)

* Closes #11851: Add family field to IPAddress queries in GraphQL

* Add family field support to Prefix and Aggregate, fix tests
This commit is contained in:
rmanyari
2023-03-10 12:48:45 -07:00
committed by GitHub
parent 07b0b93256
commit ab303db3dd
2 changed files with 29 additions and 3 deletions

View File

@ -17,6 +17,8 @@ from utilities.api import get_graphql_type_for_model
from .base import ModelTestCase
from .utils import disable_warnings
from ipam.graphql.types import IPAddressFamilyType
__all__ = (
'APITestCase',
@ -460,6 +462,8 @@ class APIViewTestCases:
# TODO: Come up with something more elegant
# Temporary hack to support automated testing of reverse generic relations
fields_string += f'{field_name} {{ id }}\n'
elif inspect.isclass(field.type) and issubclass(field.type, IPAddressFamilyType):
fields_string += f'{field_name} {{ value, label }}\n'
else:
fields_string += f'{field_name}\n'