Add template_language field to Graph

This commit is contained in:
Jeremy Stretch
2020-01-10 11:28:50 -05:00
parent 03b22594e8
commit 9399652dd0
9 changed files with 56 additions and 13 deletions

View File

@@ -18,9 +18,9 @@ class GraphTestCase(TestCase):
content_types = ContentType.objects.filter(model__in=['site', 'device', 'interface'])
graphs = (
Graph(name='Graph 1', type=content_types[0], source='http://example.com/1'),
Graph(name='Graph 2', type=content_types[1], source='http://example.com/2'),
Graph(name='Graph 3', type=content_types[2], source='http://example.com/3'),
Graph(name='Graph 1', type=content_types[0], template_language=ExportTemplateLanguageChoices.LANGUAGE_DJANGO, source='http://example.com/1'),
Graph(name='Graph 2', type=content_types[1], template_language=ExportTemplateLanguageChoices.LANGUAGE_JINJA2, source='http://example.com/2'),
Graph(name='Graph 3', type=content_types[2], template_language=ExportTemplateLanguageChoices.LANGUAGE_JINJA2, source='http://example.com/3'),
)
Graph.objects.bulk_create(graphs)
@@ -32,6 +32,11 @@ class GraphTestCase(TestCase):
params = {'type': ContentType.objects.get(model='site').pk}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1)
# TODO: Remove in v2.8
def test_template_language(self):
params = {'template_language': ExportTemplateLanguageChoices.LANGUAGE_JINJA2}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
class ExportTemplateTestCase(TestCase):
queryset = ExportTemplate.objects.all()