mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-25 00:36:11 -06:00
7961 make test cases more explicit
This commit is contained in:
parent
5298f65bd9
commit
d88d8b9e34
@ -16,11 +16,12 @@ class ClusterGroupTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
|
||||
ClusterGroup.objects.bulk_create([
|
||||
cluster_groups = (
|
||||
ClusterGroup(name='Cluster Group 1', slug='cluster-group-1'),
|
||||
ClusterGroup(name='Cluster Group 2', slug='cluster-group-2'),
|
||||
ClusterGroup(name='Cluster Group 3', slug='cluster-group-3'),
|
||||
])
|
||||
)
|
||||
ClusterGroup.objects.bulk_create(cluster_groups)
|
||||
|
||||
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
||||
|
||||
@ -39,10 +40,10 @@ class ClusterGroupTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
|
||||
)
|
||||
|
||||
cls.csv_update_data = (
|
||||
"name,description",
|
||||
"Cluster Group 7,Fourth cluster group7",
|
||||
"Cluster Group 8,Fifth cluster group8",
|
||||
"Cluster Group 9,Sixth cluster group9",
|
||||
"id,name,description",
|
||||
f"{cluster_groups[0].pk},Cluster Group 7,Fourth cluster group7",
|
||||
f"{cluster_groups[1].pk},Cluster Group 8,Fifth cluster group8",
|
||||
f"{cluster_groups[2].pk},Cluster Group 9,Sixth cluster group9",
|
||||
)
|
||||
|
||||
cls.bulk_edit_data = {
|
||||
@ -56,11 +57,12 @@ class ClusterTypeTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
|
||||
ClusterType.objects.bulk_create([
|
||||
cluster_types = (
|
||||
ClusterType(name='Cluster Type 1', slug='cluster-type-1'),
|
||||
ClusterType(name='Cluster Type 2', slug='cluster-type-2'),
|
||||
ClusterType(name='Cluster Type 3', slug='cluster-type-3'),
|
||||
])
|
||||
)
|
||||
ClusterType.objects.bulk_create(cluster_types)
|
||||
|
||||
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
||||
|
||||
@ -79,10 +81,10 @@ class ClusterTypeTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
|
||||
)
|
||||
|
||||
cls.csv_update_data = (
|
||||
"name,description",
|
||||
"Cluster Type 7,Fourth cluster type7",
|
||||
"Cluster Type 8,Fifth cluster type8",
|
||||
"Cluster Type 9,Sixth cluster type9",
|
||||
"id,name,description",
|
||||
f"{cluster_types[0].pk},Cluster Type 7,Fourth cluster type7",
|
||||
f"{cluster_types[1].pk},Cluster Type 8,Fifth cluster type8",
|
||||
f"{cluster_types[2].pk},Cluster Type 9,Sixth cluster type9",
|
||||
)
|
||||
|
||||
cls.bulk_edit_data = {
|
||||
@ -114,11 +116,12 @@ class ClusterTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
)
|
||||
ClusterType.objects.bulk_create(clustertypes)
|
||||
|
||||
Cluster.objects.bulk_create([
|
||||
clusters = (
|
||||
Cluster(name='Cluster 1', group=clustergroups[0], type=clustertypes[0], status=ClusterStatusChoices.STATUS_ACTIVE, site=sites[0]),
|
||||
Cluster(name='Cluster 2', group=clustergroups[0], type=clustertypes[0], status=ClusterStatusChoices.STATUS_ACTIVE, site=sites[0]),
|
||||
Cluster(name='Cluster 3', group=clustergroups[0], type=clustertypes[0], status=ClusterStatusChoices.STATUS_ACTIVE, site=sites[0]),
|
||||
])
|
||||
)
|
||||
Cluster.objects.bulk_create(clusters)
|
||||
|
||||
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
||||
|
||||
@ -141,10 +144,10 @@ class ClusterTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
)
|
||||
|
||||
cls.csv_update_data = (
|
||||
"name,comments",
|
||||
"Cluster 7,New comments 7",
|
||||
"Cluster 8,New comments 8",
|
||||
"Cluster 9,New comments 9",
|
||||
"id,name,comments",
|
||||
f"{clusters[0].pk},Cluster 7,New comments 7",
|
||||
f"{clusters[1].pk},Cluster 8,New comments 8",
|
||||
f"{clusters[2].pk},Cluster 9,New comments 9",
|
||||
)
|
||||
|
||||
cls.bulk_edit_data = {
|
||||
@ -208,11 +211,12 @@ class VirtualMachineTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
create_test_device('device2', site=sites[1], cluster=clusters[1]),
|
||||
)
|
||||
|
||||
VirtualMachine.objects.bulk_create([
|
||||
virtual_machines = (
|
||||
VirtualMachine(name='Virtual Machine 1', site=sites[0], cluster=clusters[0], device=devices[0], role=deviceroles[0], platform=platforms[0]),
|
||||
VirtualMachine(name='Virtual Machine 2', site=sites[0], cluster=clusters[0], device=devices[0], role=deviceroles[0], platform=platforms[0]),
|
||||
VirtualMachine(name='Virtual Machine 3', site=sites[0], cluster=clusters[0], device=devices[0], role=deviceroles[0], platform=platforms[0]),
|
||||
])
|
||||
)
|
||||
VirtualMachine.objects.bulk_create(virtual_machines)
|
||||
|
||||
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
||||
|
||||
@ -243,10 +247,10 @@ class VirtualMachineTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
)
|
||||
|
||||
cls.csv_update_data = (
|
||||
"name,comments",
|
||||
"Virtual Machine 7,New comments 7",
|
||||
"Virtual Machine 8,New comments 8",
|
||||
"Virtual Machine 9,New comments 9",
|
||||
"id,name,comments",
|
||||
f"{virtual_machines[0].pk},Virtual Machine 7,New comments 7",
|
||||
f"{virtual_machines[1].pk},Virtual Machine 8,New comments 8",
|
||||
f"{virtual_machines[2].pk},Virtual Machine 9,New comments 9",
|
||||
)
|
||||
|
||||
cls.bulk_edit_data = {
|
||||
@ -356,10 +360,10 @@ class VMInterfaceTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
||||
)
|
||||
|
||||
cls.csv_update_data = (
|
||||
f"name,description",
|
||||
f"Interface 7,New description 7",
|
||||
f"Interface 8,New description 8",
|
||||
f"Interface 9,New description 9",
|
||||
f"id,name,description",
|
||||
f"{interfaces[0].pk},Interface 7,New description 7",
|
||||
f"{interfaces[1].pk},Interface 8,New description 8",
|
||||
f"{interfaces[2].pk},Interface 9,New description 9",
|
||||
)
|
||||
|
||||
cls.bulk_edit_data = {
|
||||
|
Loading…
Reference in New Issue
Block a user