mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 10:58:37 -06:00
Make sure tests for ContentType are properly scoped
This fails because we have two "site" models - the first is the DCIM.Site and the second is Sites.site (used for allauth). Most all other queries in Netbox properly scope with app_label - this test does not.
This commit is contained in:
parent
e05ab4a16c
commit
7f85a5d179
@ -49,7 +49,7 @@ class ExportTemplateTestCase(TestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def setUpTestData(cls):
|
def setUpTestData(cls):
|
||||||
|
|
||||||
content_types = ContentType.objects.filter(model__in=['site', 'rack', 'device'])
|
content_types = ContentType.objects.filter(app_label='dcim', model__in=['site', 'rack', 'device'])
|
||||||
|
|
||||||
export_templates = (
|
export_templates = (
|
||||||
ExportTemplate(name='Export Template 1', content_type=content_types[0], template_language=TemplateLanguageChoices.LANGUAGE_DJANGO, template_code='TESTING'),
|
ExportTemplate(name='Export Template 1', content_type=content_types[0], template_language=TemplateLanguageChoices.LANGUAGE_DJANGO, template_code='TESTING'),
|
||||||
@ -63,7 +63,7 @@ class ExportTemplateTestCase(TestCase):
|
|||||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1)
|
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1)
|
||||||
|
|
||||||
def test_content_type(self):
|
def test_content_type(self):
|
||||||
params = {'content_type': ContentType.objects.get(model='site').pk}
|
params = {'content_type': ContentType.objects.get(app_label='dcim', model='site').pk}
|
||||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1)
|
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1)
|
||||||
|
|
||||||
def test_template_language(self):
|
def test_template_language(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user