diff --git a/netbox_acls/graphql/__init__.py b/netbox_acls/graphql/__init__.py new file mode 100644 index 0000000..dd2a695 --- /dev/null +++ b/netbox_acls/graphql/__init__.py @@ -0,0 +1,2 @@ +from .schema import * +from .types import * diff --git a/netbox_acls/graphql/schema.py b/netbox_acls/graphql/schema.py new file mode 100644 index 0000000..cdaa8a2 --- /dev/null +++ b/netbox_acls/graphql/schema.py @@ -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 diff --git a/netbox_acls/graphql.py b/netbox_acls/graphql/types.py similarity index 73% rename from netbox_acls/graphql.py rename to netbox_acls/graphql/types.py index 8de0dd2..9e05942 100644 --- a/netbox_acls/graphql.py +++ b/netbox_acls/graphql/types.py @@ -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 @@ "ACLStandardRuleType", ) -# -# Object types -# - class AccessListType(NetBoxObjectType): """ @@ -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 diff --git a/netbox_acls/tests/test_api.py b/netbox_acls/tests/test_api.py index afbd4fa..77559e6 100644 --- a/netbox_acls/tests/test_api.py +++ b/netbox_acls/tests/test_api.py @@ -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"""