updated graphql api (#140)

This commit is contained in:
Abhimanyu Saharan 2023-02-05 23:06:56 +05:30 committed by GitHub
parent 269354f3c0
commit 1cdc9a4924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 34 deletions

View File

@ -0,0 +1,2 @@
from .schema import *
from .types import *

View File

@ -0,0 +1,21 @@
from graphene import ObjectType
from netbox.graphql.fields import ObjectField, ObjectListField
from .types import *
class Query(ObjectType):
"""
Defines the queries available to this plugin via the graphql api.
"""
access_list = ObjectField(AccessListType)
access_list_list = ObjectListField(AccessListType)
acl_extended_rule = ObjectField(ACLExtendedRuleType)
acl_extended_rule_list = ObjectListField(ACLExtendedRuleType)
acl_standard_rule = ObjectField(ACLStandardRuleType)
acl_standard_rule_list = ObjectListField(ACLStandardRuleType)
schema = Query

View File

@ -2,11 +2,9 @@
Define the object types and queries availble via the graphql api.
"""
from graphene import ObjectType
from netbox.graphql.fields import ObjectField, ObjectListField
from netbox.graphql.types import NetBoxObjectType
from . import filtersets, models
from .. import filtersets, models
__all__ = (
"AccessListType",
@ -15,10 +13,6 @@ __all__ = (
"ACLStandardRuleType",
)
#
# Object types
#
class AccessListType(NetBoxObjectType):
"""
@ -79,25 +73,3 @@ class ACLStandardRuleType(NetBoxObjectType):
fields = "__all__"
filterset_class = filtersets.ACLStandardRuleFilterSet
#
# Queries
#
class Query(ObjectType):
"""
Defines the queries availible to this plugin via the graphql api.
"""
access_list = ObjectField(AccessListType)
access_list_list = ObjectListField(AccessListType)
acl_extended_rule = ObjectField(ACLExtendedRuleType)
acl_extended_rule_list = ObjectListField(ACLExtendedRuleType)
acl_standard_rule = ObjectField(ACLStandardRuleType)
acl_standard_rule_list = ObjectListField(ACLStandardRuleType)
schema = Query

View File

@ -17,11 +17,7 @@ class AppTest(APITestCase):
class ACLTestCase(
APIViewTestCases.GetObjectViewTestCase,
APIViewTestCases.ListObjectsViewTestCase,
APIViewTestCases.CreateObjectViewTestCase,
APIViewTestCases.UpdateObjectViewTestCase,
APIViewTestCases.DeleteObjectViewTestCase,
APIViewTestCases.APIViewTestCase,
):
"""Test the AccessList Test"""