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

9856 circuits test sans DjangoModelType

This commit is contained in:
Arthur
2024-03-06 15:44:40 -08:00
parent 7c66a6aba8
commit 28ac66b0fb
4 changed files with 21 additions and 13 deletions

View File

@ -472,13 +472,21 @@ class APIViewTestCases:
# this would require a fragment query
continue
elif field.type is strawberry_django.fields.types.DjangoModelType:
print("")
print("DjangoModelType")
print(f"{self.model} -> {field.name}")
print("")
# Dynamic fields must specify a subselection
fields_string += f'{field.name} {{ pk }}\n'
fields_string += f'{field.name} {{ id }}\n'
elif type(field.type) is StrawberryOptional:
if type(field.type.of_type) is LazyType:
fields_string += f'{field.name} {{ id }}\n'
elif field.type.of_type == strawberry_django.fields.types.DjangoModelType:
fields_string += f'{field.name} {{ pk }}\n'
print("")
print("DjangoModelType")
print(f"{self.model} -> {field.name}")
print("")
fields_string += f'{field.name} {{ id }}\n'
elif hasattr(field, 'is_relation') and field.is_relation:
# Note: StrawberryField types do not have is_relation
fields_string += f'{field.name} {{ id }}\n'