1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Add tests for ConfigTemplate

This commit is contained in:
jeremystretch
2023-04-11 15:25:48 -04:00
parent f68a63255b
commit 46d7bf02ac
4 changed files with 102 additions and 1 deletions

View File

@ -513,6 +513,46 @@ class ConfigContextTest(APIViewTestCases.APIViewTestCase):
self.assertEqual(rendered_context['bar'], 456)
class ConfigTemplateTest(APIViewTestCases.APIViewTestCase):
model = ConfigTemplate
brief_fields = ['display', 'id', 'name', 'url']
create_data = [
{
'name': 'Config Template 4',
'template_code': 'Foo: {{ foo }}',
},
{
'name': 'Config Template 5',
'template_code': 'Bar: {{ bar }}',
},
{
'name': 'Config Template 6',
'template_code': 'Baz: {{ baz }}',
},
]
bulk_update_data = {
'description': 'New description',
}
@classmethod
def setUpTestData(cls):
config_templates = (
ConfigTemplate(
name='Config Template 1',
template_code='Foo: {{ foo }}'
),
ConfigTemplate(
name='Config Template 2',
template_code='Bar: {{ bar }}'
),
ConfigTemplate(
name='Config Template 3',
template_code='Baz: {{ baz }}'
),
)
ConfigTemplate.objects.bulk_create(config_templates)
class ReportTest(APITestCase):
class TestReport(Report):