mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-25 08:46:10 -06:00
7961 make test cases more explicit
This commit is contained in:
parent
0903b0a3ad
commit
44f60d8331
@ -49,11 +49,10 @@ class CustomFieldTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
'label',
|
'id,label',
|
||||||
'New label 1',
|
f'{custom_fields[0].pk},New label 1',
|
||||||
'New label 2',
|
f'{custom_fields[1].pk},New label 2',
|
||||||
'New label 3',
|
f'{custom_fields[2].pk},New label 3',
|
||||||
'New label 4',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
@ -69,11 +68,12 @@ class CustomLinkTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
def setUpTestData(cls):
|
def setUpTestData(cls):
|
||||||
|
|
||||||
site_ct = ContentType.objects.get_for_model(Site)
|
site_ct = ContentType.objects.get_for_model(Site)
|
||||||
CustomLink.objects.bulk_create((
|
custom_links = (
|
||||||
CustomLink(name='Custom Link 1', content_type=site_ct, enabled=True, link_text='Link 1', link_url='http://example.com/?1'),
|
CustomLink(name='Custom Link 1', content_type=site_ct, enabled=True, link_text='Link 1', link_url='http://example.com/?1'),
|
||||||
CustomLink(name='Custom Link 2', content_type=site_ct, enabled=True, link_text='Link 2', link_url='http://example.com/?2'),
|
CustomLink(name='Custom Link 2', content_type=site_ct, enabled=True, link_text='Link 2', link_url='http://example.com/?2'),
|
||||||
CustomLink(name='Custom Link 3', content_type=site_ct, enabled=False, link_text='Link 3', link_url='http://example.com/?3'),
|
CustomLink(name='Custom Link 3', content_type=site_ct, enabled=False, link_text='Link 3', link_url='http://example.com/?3'),
|
||||||
))
|
)
|
||||||
|
CustomLink.objects.bulk_create(custom_links)
|
||||||
|
|
||||||
cls.form_data = {
|
cls.form_data = {
|
||||||
'name': 'Custom Link X',
|
'name': 'Custom Link X',
|
||||||
@ -93,10 +93,10 @@ class CustomLinkTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
"name",
|
"id,name",
|
||||||
"Custom Link 7",
|
f"{custom_links[0].pk},Custom Link 7",
|
||||||
"Custom Link 8",
|
f"{custom_links[1].pk},Custom Link 8",
|
||||||
"Custom Link 9",
|
f"{custom_links[2].pk},Custom Link 9",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
@ -114,11 +114,13 @@ class ExportTemplateTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
|
|
||||||
site_ct = ContentType.objects.get_for_model(Site)
|
site_ct = ContentType.objects.get_for_model(Site)
|
||||||
TEMPLATE_CODE = """{% for object in queryset %}{{ object }}{% endfor %}"""
|
TEMPLATE_CODE = """{% for object in queryset %}{{ object }}{% endfor %}"""
|
||||||
ExportTemplate.objects.bulk_create((
|
|
||||||
|
export_templates = (
|
||||||
ExportTemplate(name='Export Template 1', content_type=site_ct, template_code=TEMPLATE_CODE),
|
ExportTemplate(name='Export Template 1', content_type=site_ct, template_code=TEMPLATE_CODE),
|
||||||
ExportTemplate(name='Export Template 2', content_type=site_ct, template_code=TEMPLATE_CODE),
|
ExportTemplate(name='Export Template 2', content_type=site_ct, template_code=TEMPLATE_CODE),
|
||||||
ExportTemplate(name='Export Template 3', content_type=site_ct, template_code=TEMPLATE_CODE),
|
ExportTemplate(name='Export Template 3', content_type=site_ct, template_code=TEMPLATE_CODE),
|
||||||
))
|
)
|
||||||
|
ExportTemplate.objects.bulk_create(export_templates)
|
||||||
|
|
||||||
cls.form_data = {
|
cls.form_data = {
|
||||||
'name': 'Export Template X',
|
'name': 'Export Template X',
|
||||||
@ -134,10 +136,10 @@ class ExportTemplateTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
"name",
|
"id,name",
|
||||||
f"Export Template 7",
|
f"{export_templates[0].pk},Export Template 7",
|
||||||
f"Export Template 8",
|
f"{export_templates[1].pk},Export Template 8",
|
||||||
f"Export Template 9",
|
f"{export_templates[2].pk},Export Template 9",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
@ -183,10 +185,10 @@ class WebhookTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
"name",
|
"id,name",
|
||||||
"Webhook 7",
|
f"{webhooks[0].pk},Webhook 7",
|
||||||
"Webhook 8",
|
f"{webhooks[1].pk},Webhook 8",
|
||||||
"Webhook 9",
|
f"{webhooks[2].pk},Webhook 9",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
@ -204,11 +206,12 @@ class TagTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def setUpTestData(cls):
|
def setUpTestData(cls):
|
||||||
|
|
||||||
Tag.objects.bulk_create((
|
tags = (
|
||||||
Tag(name='Tag 1', slug='tag-1'),
|
Tag(name='Tag 1', slug='tag-1'),
|
||||||
Tag(name='Tag 2', slug='tag-2'),
|
Tag(name='Tag 2', slug='tag-2'),
|
||||||
Tag(name='Tag 3', slug='tag-3'),
|
Tag(name='Tag 3', slug='tag-3'),
|
||||||
))
|
)
|
||||||
|
Tag.objects.bulk_create(tags)
|
||||||
|
|
||||||
cls.form_data = {
|
cls.form_data = {
|
||||||
'name': 'Tag X',
|
'name': 'Tag X',
|
||||||
@ -225,10 +228,10 @@ class TagTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
"name,description",
|
"id,name,description",
|
||||||
"Tag 7,Fourth tag7",
|
f"{tags[0].pk},Tag 7,Fourth tag7",
|
||||||
"Tag 8,Fifth tag8",
|
f"{tags[1].pk},Tag 8,Fifth tag8",
|
||||||
"Tag 9,Sixth tag9",
|
f"{tags[2].pk},Tag 9,Sixth tag9",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
|
Loading…
Reference in New Issue
Block a user