Skip to content

Commit

Permalink
Merge branch 'dev' into issue_47
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi1693 authored Feb 5, 2023
2 parents 36920fb + 1cdc9a4 commit 6fd9fba
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 34 deletions.
2 changes: 2 additions & 0 deletions netbox_acls/graphql/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .schema import *
from .types import *
21 changes: 21 additions & 0 deletions netbox_acls/graphql/schema.py
Original file line number Diff line number Diff line change
@@ -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
30 changes: 1 addition & 29 deletions netbox_acls/graphql.py → netbox_acls/graphql/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -15,10 +13,6 @@
"ACLStandardRuleType",
)

#
# Object types
#


class AccessListType(NetBoxObjectType):
"""
Expand Down Expand Up @@ -79,25 +73,3 @@ class Meta:
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
6 changes: 1 addition & 5 deletions netbox_acls/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ def test_root(self):


class ACLTestCase(
APIViewTestCases.GetObjectViewTestCase,
APIViewTestCases.ListObjectsViewTestCase,
APIViewTestCases.CreateObjectViewTestCase,
APIViewTestCases.UpdateObjectViewTestCase,
APIViewTestCases.DeleteObjectViewTestCase,
APIViewTestCases.APIViewTestCase,
):
"""Test the AccessList Test"""

Expand Down

0 comments on commit 6fd9fba

Please sign in to comment.