mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
View tests
This commit is contained in:
parent
b75f142ce4
commit
0985ef43d3
@ -702,7 +702,7 @@ class VLANTranslationPolicyForm(NetBoxModelForm):
|
||||
class Meta:
|
||||
model = VLANTranslationPolicy
|
||||
fields = [
|
||||
'name', 'description',
|
||||
'name', 'description', 'tags',
|
||||
]
|
||||
|
||||
|
||||
|
@ -863,6 +863,55 @@ class VLANTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
}
|
||||
|
||||
|
||||
class VLANTranslationPolicyTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
model = VLANTranslationPolicy
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
|
||||
vlan_translation_policies = (
|
||||
VLANTranslationPolicy(
|
||||
name='Policy 1',
|
||||
description='foobar1',
|
||||
),
|
||||
VLANTranslationPolicy(
|
||||
name='Policy 2',
|
||||
description='foobar2',
|
||||
),
|
||||
VLANTranslationPolicy(
|
||||
name='Policy 3',
|
||||
description='foobar3',
|
||||
),
|
||||
)
|
||||
VLANTranslationPolicy.objects.bulk_create(vlan_translation_policies)
|
||||
|
||||
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
||||
|
||||
cls.form_data = {
|
||||
'name': 'Policy999',
|
||||
'description': 'A new VLAN Translation Policy',
|
||||
'tags': [t.pk for t in tags],
|
||||
}
|
||||
|
||||
cls.csv_data = (
|
||||
"name,description",
|
||||
"Policy101,foobar1",
|
||||
"Policy102,foobar2",
|
||||
"Policy103,foobar3",
|
||||
)
|
||||
|
||||
cls.csv_update_data = (
|
||||
"id,name,description",
|
||||
f"{vlan_translation_policies[0].pk},Policy101,New description 1",
|
||||
f"{vlan_translation_policies[1].pk},Policy102,New description 2",
|
||||
f"{vlan_translation_policies[2].pk},Policy103,New description 3",
|
||||
)
|
||||
|
||||
cls.bulk_edit_data = {
|
||||
'description': 'New description',
|
||||
}
|
||||
|
||||
|
||||
class ServiceTemplateTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
model = ServiceTemplate
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user