rename FeatureQuery class

This commit is contained in:
John Anderson
2020-03-16 11:58:35 -04:00
parent 62ad7734b2
commit 9a38586e13
7 changed files with 24 additions and 24 deletions

View File

@@ -10,7 +10,7 @@ from extras.api.views import ScriptViewSet
from extras.choices import *
from extras.models import ConfigContext, Graph, ExportTemplate, Tag
from extras.scripts import BooleanVar, IntegerVar, Script, StringVar
from extras.utils import FeatureQuerySet
from extras.utils import FeatureQuery
from tenancy.models import Tenant, TenantGroup
from utilities.testing import APITestCase, choices_to_dict
@@ -35,7 +35,7 @@ class AppTest(APITestCase):
self.assertEqual(choices_to_dict(response.data.get('export-template:template_language')), TemplateLanguageChoices.as_dict())
# Graph
content_types = ContentType.objects.filter(FeatureQuerySet('graphs').get_queryset())
content_types = ContentType.objects.filter(FeatureQuery('graphs').get_query())
graph_type_choices = {
"{}.{}".format(ct.app_label, ct.model): ct.name for ct in content_types
}

View File

@@ -4,7 +4,7 @@ from django.test import TestCase
from dcim.models import DeviceRole, Platform, Region, Site
from extras.choices import *
from extras.filters import *
from extras.utils import FeatureQuerySet
from extras.utils import FeatureQuery
from extras.models import ConfigContext, ExportTemplate, Graph
from tenancy.models import Tenant, TenantGroup
from virtualization.models import Cluster, ClusterGroup, ClusterType
@@ -18,7 +18,7 @@ class GraphTestCase(TestCase):
def setUpTestData(cls):
# Get the first three available types
content_types = ContentType.objects.filter(FeatureQuerySet('graphs').get_queryset())[:3]
content_types = ContentType.objects.filter(FeatureQuery('graphs').get_query())[:3]
graphs = (
Graph(name='Graph 1', type=content_types[0], template_language=TemplateLanguageChoices.LANGUAGE_DJANGO, source='http://example.com/1'),
@@ -32,7 +32,7 @@ class GraphTestCase(TestCase):
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
def test_type(self):
content_type = ContentType.objects.filter(FeatureQuerySet('graphs').get_queryset()).first()
content_type = ContentType.objects.filter(FeatureQuery('graphs').get_query()).first()
params = {'type': content_type.pk}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1)