mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 19:08:38 -06:00
Clean up GraphQL tests
This commit is contained in:
parent
a2d9e525ff
commit
984e815cdf
0
netbox/circuits/graphql/__init__.py
Normal file
0
netbox/circuits/graphql/__init__.py
Normal file
@ -1,33 +1,21 @@
|
|||||||
from circuits import filtersets, models
|
from circuits import filtersets, models
|
||||||
from netbox.graphql.types import *
|
from netbox.graphql.types import BaseObjectType, ObjectType, TaggedObjectType
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'CircuitType',
|
|
||||||
'CircuitTerminationType',
|
'CircuitTerminationType',
|
||||||
|
'CircuitType',
|
||||||
'CircuitTypeType',
|
'CircuitTypeType',
|
||||||
'ProviderType',
|
'ProviderType',
|
||||||
'ProviderNetworkType',
|
'ProviderNetworkType',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
#
|
class CircuitTerminationType(BaseObjectType):
|
||||||
# Object types
|
|
||||||
#
|
|
||||||
|
|
||||||
class ProviderType(TaggedObjectType):
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Provider
|
model = models.CircuitTermination
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
filterset_class = filtersets.ProviderFilterSet
|
filterset_class = filtersets.CircuitTerminationFilterSet
|
||||||
|
|
||||||
|
|
||||||
class ProviderNetworkType(TaggedObjectType):
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
model = models.ProviderNetwork
|
|
||||||
fields = '__all__'
|
|
||||||
filterset_class = filtersets.ProviderNetworkFilterSet
|
|
||||||
|
|
||||||
|
|
||||||
class CircuitType(TaggedObjectType):
|
class CircuitType(TaggedObjectType):
|
||||||
@ -46,9 +34,17 @@ class CircuitTypeType(ObjectType):
|
|||||||
filterset_class = filtersets.CircuitTypeFilterSet
|
filterset_class = filtersets.CircuitTypeFilterSet
|
||||||
|
|
||||||
|
|
||||||
class CircuitTerminationType(BaseObjectType):
|
class ProviderType(TaggedObjectType):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.CircuitTermination
|
model = models.Provider
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
filterset_class = filtersets.CircuitTerminationFilterSet
|
filterset_class = filtersets.ProviderFilterSet
|
||||||
|
|
||||||
|
|
||||||
|
class ProviderNetworkType(TaggedObjectType):
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = models.ProviderNetwork
|
||||||
|
fields = '__all__'
|
||||||
|
filterset_class = filtersets.ProviderNetworkFilterSet
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import graphene
|
import graphene
|
||||||
|
|
||||||
from circuits.graphql.schema import CircuitsQuery
|
from circuits.graphql.schema import CircuitsQuery
|
||||||
|
from ipam.graphql.schema import IPAMQuery
|
||||||
|
|
||||||
|
|
||||||
class Query(
|
class Query(
|
||||||
CircuitsQuery,
|
CircuitsQuery,
|
||||||
|
IPAMQuery,
|
||||||
graphene.ObjectType
|
graphene.ObjectType
|
||||||
):
|
):
|
||||||
pass
|
pass
|
||||||
|
@ -428,7 +428,7 @@ class APIViewTestCases:
|
|||||||
@override_settings(LOGIN_REQUIRED=True)
|
@override_settings(LOGIN_REQUIRED=True)
|
||||||
def test_graphql_get_object(self):
|
def test_graphql_get_object(self):
|
||||||
url = reverse('graphql')
|
url = reverse('graphql')
|
||||||
object_type = self.model._meta.verbose_name.replace(' ', '_')
|
object_type = self.model._meta.verbose_name.lower().replace(' ', '_')
|
||||||
object_id = self._get_queryset().first().pk
|
object_id = self._get_queryset().first().pk
|
||||||
query = f"""
|
query = f"""
|
||||||
{{
|
{{
|
||||||
@ -459,7 +459,7 @@ class APIViewTestCases:
|
|||||||
@override_settings(LOGIN_REQUIRED=True)
|
@override_settings(LOGIN_REQUIRED=True)
|
||||||
def test_graphql_list_objects(self):
|
def test_graphql_list_objects(self):
|
||||||
url = reverse('graphql')
|
url = reverse('graphql')
|
||||||
object_type = self.model._meta.verbose_name_plural.replace(' ', '_')
|
object_type = self.model._meta.verbose_name_plural.lower().replace(' ', '_')
|
||||||
query = f"""
|
query = f"""
|
||||||
{{
|
{{
|
||||||
{object_type} {{
|
{object_type} {{
|
||||||
|
Loading…
Reference in New Issue
Block a user