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

@@ -360,6 +360,45 @@ class ConfigContextTestCase(
}
class ConfigTemplateTestCase(
ViewTestCases.GetObjectViewTestCase,
ViewTestCases.GetObjectChangelogViewTestCase,
ViewTestCases.DeleteObjectViewTestCase,
ViewTestCases.ListObjectsViewTestCase,
ViewTestCases.BulkEditObjectsViewTestCase,
ViewTestCases.BulkDeleteObjectsViewTestCase
):
model = ConfigTemplate
@classmethod
def setUpTestData(cls):
TEMPLATE_CODE = """Foo: {{ foo }}"""
config_templates = (
ConfigTemplate(name='Config Template 1', template_code=TEMPLATE_CODE),
ConfigTemplate(name='Config Template 2', template_code=TEMPLATE_CODE),
ConfigTemplate(name='Config Template 3', template_code=TEMPLATE_CODE),
)
ConfigTemplate.objects.bulk_create(config_templates)
cls.form_data = {
'name': 'Config Template X',
'description': 'Config template',
'template_code': TEMPLATE_CODE,
}
cls.csv_update_data = (
"id,name",
f"{config_templates[0].pk},Config Template 7",
f"{config_templates[1].pk},Config Template 8",
f"{config_templates[2].pk},Config Template 9",
)
cls.bulk_edit_data = {
'description': 'New description',
}
# TODO: Convert to StandardTestCases.Views
class ObjectChangeTestCase(TestCase):
user_permissions = (