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
44f60d8331
commit
375bec9698
@ -61,10 +61,10 @@ class ASNTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
"description",
|
"id,description",
|
||||||
"New description1",
|
f"{asns[0].pk},New description1",
|
||||||
"New description2",
|
f"{asns[1].pk},New description2",
|
||||||
"New description3",
|
f"{asns[2].pk},New description3",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
@ -85,11 +85,12 @@ class VRFTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
Tenant.objects.bulk_create(tenants)
|
Tenant.objects.bulk_create(tenants)
|
||||||
|
|
||||||
VRF.objects.bulk_create([
|
vrfs = (
|
||||||
VRF(name='VRF 1', rd='65000:1'),
|
VRF(name='VRF 1', rd='65000:1'),
|
||||||
VRF(name='VRF 2', rd='65000:2'),
|
VRF(name='VRF 2', rd='65000:2'),
|
||||||
VRF(name='VRF 3', rd='65000:3'),
|
VRF(name='VRF 3', rd='65000:3'),
|
||||||
])
|
)
|
||||||
|
VRF.objects.bulk_create(vrfs)
|
||||||
|
|
||||||
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
||||||
|
|
||||||
@ -110,10 +111,10 @@ class VRFTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
"name",
|
"id,name",
|
||||||
"VRF 7",
|
f"{vrfs[0].pk},VRF 7",
|
||||||
"VRF 8",
|
f"{vrfs[1].pk},VRF 8",
|
||||||
"VRF 9",
|
f"{vrfs[2].pk},VRF 9",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
@ -158,10 +159,10 @@ class RouteTargetTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
"name,description",
|
"id,name,description",
|
||||||
"65000:1007,New description1",
|
f"{route_targets[0].pk},65000:1007,New description1",
|
||||||
"65000:1008,New description2",
|
f"{route_targets[1].pk},65000:1008,New description2",
|
||||||
"65000:1009,New description3",
|
f"{route_targets[2].pk},65000:1009,New description3",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
@ -176,11 +177,12 @@ class RIRTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def setUpTestData(cls):
|
def setUpTestData(cls):
|
||||||
|
|
||||||
RIR.objects.bulk_create([
|
rirs = (
|
||||||
RIR(name='RIR 1', slug='rir-1'),
|
RIR(name='RIR 1', slug='rir-1'),
|
||||||
RIR(name='RIR 2', slug='rir-2'),
|
RIR(name='RIR 2', slug='rir-2'),
|
||||||
RIR(name='RIR 3', slug='rir-3'),
|
RIR(name='RIR 3', slug='rir-3'),
|
||||||
])
|
)
|
||||||
|
RIR.objects.bulk_create(rirs)
|
||||||
|
|
||||||
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
||||||
|
|
||||||
@ -200,10 +202,10 @@ class RIRTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
"name,description",
|
"id,name,description",
|
||||||
"RIR 7,Fourth RIR7",
|
f"{rirs[0].pk},RIR 7,Fourth RIR7",
|
||||||
"RIR 8,Fifth RIR8",
|
f"{rirs[1].pk},RIR 8,Fifth RIR8",
|
||||||
"RIR 9,Sixth RIR9",
|
f"{rirs[2].pk},RIR 9,Sixth RIR9",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
@ -223,11 +225,12 @@ class AggregateTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
RIR.objects.bulk_create(rirs)
|
RIR.objects.bulk_create(rirs)
|
||||||
|
|
||||||
Aggregate.objects.bulk_create([
|
aggregates = (
|
||||||
Aggregate(prefix=IPNetwork('10.1.0.0/16'), rir=rirs[0]),
|
Aggregate(prefix=IPNetwork('10.1.0.0/16'), rir=rirs[0]),
|
||||||
Aggregate(prefix=IPNetwork('10.2.0.0/16'), rir=rirs[0]),
|
Aggregate(prefix=IPNetwork('10.2.0.0/16'), rir=rirs[0]),
|
||||||
Aggregate(prefix=IPNetwork('10.3.0.0/16'), rir=rirs[0]),
|
Aggregate(prefix=IPNetwork('10.3.0.0/16'), rir=rirs[0]),
|
||||||
])
|
)
|
||||||
|
Aggregate.objects.bulk_create(aggregates)
|
||||||
|
|
||||||
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
||||||
|
|
||||||
@ -247,10 +250,10 @@ class AggregateTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
"description",
|
"id,description",
|
||||||
"New description1",
|
f"{aggregates[0].pk},New description1",
|
||||||
"New description2",
|
f"{aggregates[1].pk},New description2",
|
||||||
"New description3",
|
f"{aggregates[2].pk},New description3",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
@ -281,11 +284,12 @@ class RoleTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def setUpTestData(cls):
|
def setUpTestData(cls):
|
||||||
|
|
||||||
Role.objects.bulk_create([
|
roles = (
|
||||||
Role(name='Role 1', slug='role-1'),
|
Role(name='Role 1', slug='role-1'),
|
||||||
Role(name='Role 2', slug='role-2'),
|
Role(name='Role 2', slug='role-2'),
|
||||||
Role(name='Role 3', slug='role-3'),
|
Role(name='Role 3', slug='role-3'),
|
||||||
])
|
)
|
||||||
|
Role.objects.bulk_create(roles)
|
||||||
|
|
||||||
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
||||||
|
|
||||||
@ -305,10 +309,10 @@ class RoleTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
"name,description",
|
"id,name,description",
|
||||||
"Role 7,New description7",
|
f"{roles[0].pk},Role 7,New description7",
|
||||||
"Role 8,New description8",
|
f"{roles[1].pk},Role 8,New description8",
|
||||||
"Role 9,New description9",
|
f"{roles[2].pk},Role 9,New description9",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
@ -340,11 +344,12 @@ class PrefixTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
Role.objects.bulk_create(roles)
|
Role.objects.bulk_create(roles)
|
||||||
|
|
||||||
Prefix.objects.bulk_create([
|
prefixes = (
|
||||||
Prefix(prefix=IPNetwork('10.1.0.0/16'), vrf=vrfs[0], site=sites[0], role=roles[0]),
|
Prefix(prefix=IPNetwork('10.1.0.0/16'), vrf=vrfs[0], site=sites[0], role=roles[0]),
|
||||||
Prefix(prefix=IPNetwork('10.2.0.0/16'), vrf=vrfs[0], site=sites[0], role=roles[0]),
|
Prefix(prefix=IPNetwork('10.2.0.0/16'), vrf=vrfs[0], site=sites[0], role=roles[0]),
|
||||||
Prefix(prefix=IPNetwork('10.3.0.0/16'), vrf=vrfs[0], site=sites[0], role=roles[0]),
|
Prefix(prefix=IPNetwork('10.3.0.0/16'), vrf=vrfs[0], site=sites[0], role=roles[0]),
|
||||||
])
|
)
|
||||||
|
Prefix.objects.bulk_create(prefixes)
|
||||||
|
|
||||||
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
||||||
|
|
||||||
@ -369,10 +374,10 @@ class PrefixTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
"description,status",
|
"id,description,status",
|
||||||
f"New description 7,{PrefixStatusChoices.STATUS_RESERVED}",
|
f"{prefixes[0].pk},New description 7,{PrefixStatusChoices.STATUS_RESERVED}",
|
||||||
f"New description 8,{PrefixStatusChoices.STATUS_RESERVED}",
|
f"{prefixes[1].pk},New description 8,{PrefixStatusChoices.STATUS_RESERVED}",
|
||||||
f"New description 9,{PrefixStatusChoices.STATUS_RESERVED}",
|
f"{prefixes[2].pk},New description 9,{PrefixStatusChoices.STATUS_RESERVED}",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
@ -478,10 +483,10 @@ class IPRangeTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
"description,status",
|
"id,description,status",
|
||||||
f"New description 7,{IPRangeStatusChoices.STATUS_RESERVED}",
|
f"{ip_ranges[0].pk},New description 7,{IPRangeStatusChoices.STATUS_RESERVED}",
|
||||||
f"New description 8,{IPRangeStatusChoices.STATUS_RESERVED}",
|
f"{ip_ranges[1].pk},New description 8,{IPRangeStatusChoices.STATUS_RESERVED}",
|
||||||
f"New description 9,{IPRangeStatusChoices.STATUS_RESERVED}",
|
f"{ip_ranges[2].pk},New description 9,{IPRangeStatusChoices.STATUS_RESERVED}",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
@ -523,11 +528,12 @@ class IPAddressTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
VRF.objects.bulk_create(vrfs)
|
VRF.objects.bulk_create(vrfs)
|
||||||
|
|
||||||
IPAddress.objects.bulk_create([
|
ipaddresses = (
|
||||||
IPAddress(address=IPNetwork('192.0.2.1/24'), vrf=vrfs[0]),
|
IPAddress(address=IPNetwork('192.0.2.1/24'), vrf=vrfs[0]),
|
||||||
IPAddress(address=IPNetwork('192.0.2.2/24'), vrf=vrfs[0]),
|
IPAddress(address=IPNetwork('192.0.2.2/24'), vrf=vrfs[0]),
|
||||||
IPAddress(address=IPNetwork('192.0.2.3/24'), vrf=vrfs[0]),
|
IPAddress(address=IPNetwork('192.0.2.3/24'), vrf=vrfs[0]),
|
||||||
])
|
)
|
||||||
|
IPAddress.objects.bulk_create(ipaddresses)
|
||||||
|
|
||||||
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
||||||
|
|
||||||
@ -551,10 +557,10 @@ class IPAddressTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
"description,status",
|
"id,description,status",
|
||||||
f"New description 7,{IPAddressStatusChoices.STATUS_RESERVED}",
|
f"{ipaddresses[0].pk},New description 7,{IPAddressStatusChoices.STATUS_RESERVED}",
|
||||||
f"New description 8,{IPAddressStatusChoices.STATUS_RESERVED}",
|
f"{ipaddresses[1].pk},New description 8,{IPAddressStatusChoices.STATUS_RESERVED}",
|
||||||
f"New description 9,{IPAddressStatusChoices.STATUS_RESERVED}",
|
f"{ipaddresses[2].pk},New description 9,{IPAddressStatusChoices.STATUS_RESERVED}",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
@ -573,11 +579,12 @@ class FHRPGroupTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def setUpTestData(cls):
|
def setUpTestData(cls):
|
||||||
|
|
||||||
FHRPGroup.objects.bulk_create((
|
fhrp_groups = (
|
||||||
FHRPGroup(protocol=FHRPGroupProtocolChoices.PROTOCOL_VRRP2, group_id=10, auth_type=FHRPGroupAuthTypeChoices.AUTHENTICATION_PLAINTEXT, auth_key='foobar123'),
|
FHRPGroup(protocol=FHRPGroupProtocolChoices.PROTOCOL_VRRP2, group_id=10, auth_type=FHRPGroupAuthTypeChoices.AUTHENTICATION_PLAINTEXT, auth_key='foobar123'),
|
||||||
FHRPGroup(protocol=FHRPGroupProtocolChoices.PROTOCOL_VRRP3, group_id=20, auth_type=FHRPGroupAuthTypeChoices.AUTHENTICATION_MD5, auth_key='foobar123'),
|
FHRPGroup(protocol=FHRPGroupProtocolChoices.PROTOCOL_VRRP3, group_id=20, auth_type=FHRPGroupAuthTypeChoices.AUTHENTICATION_MD5, auth_key='foobar123'),
|
||||||
FHRPGroup(protocol=FHRPGroupProtocolChoices.PROTOCOL_HSRP, group_id=30),
|
FHRPGroup(protocol=FHRPGroupProtocolChoices.PROTOCOL_HSRP, group_id=30),
|
||||||
))
|
)
|
||||||
|
FHRPGroup.objects.bulk_create(fhrp_groups)
|
||||||
|
|
||||||
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
||||||
|
|
||||||
@ -599,10 +606,10 @@ class FHRPGroupTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
"name,description",
|
"id,name,description",
|
||||||
"FHRP Group 1,New description 1",
|
f"{fhrp_groups[0].pk},FHRP Group 1,New description 1",
|
||||||
"FHRP Group 2,New description 2",
|
f"{fhrp_groups[1].pk},FHRP Group 2,New description 2",
|
||||||
"FHRP Group 3,New description 3",
|
f"{fhrp_groups[2].pk},FHRP Group 3,New description 3",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
@ -622,11 +629,12 @@ class VLANGroupTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
Site.objects.bulk_create(sites)
|
Site.objects.bulk_create(sites)
|
||||||
|
|
||||||
VLANGroup.objects.bulk_create([
|
vlan_groups = (
|
||||||
VLANGroup(name='VLAN Group 1', slug='vlan-group-1', scope=sites[0]),
|
VLANGroup(name='VLAN Group 1', slug='vlan-group-1', scope=sites[0]),
|
||||||
VLANGroup(name='VLAN Group 2', slug='vlan-group-2', scope=sites[0]),
|
VLANGroup(name='VLAN Group 2', slug='vlan-group-2', scope=sites[0]),
|
||||||
VLANGroup(name='VLAN Group 3', slug='vlan-group-3', scope=sites[0]),
|
VLANGroup(name='VLAN Group 3', slug='vlan-group-3', scope=sites[0]),
|
||||||
])
|
)
|
||||||
|
VLANGroup.objects.bulk_create(vlan_groups)
|
||||||
|
|
||||||
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
||||||
|
|
||||||
@ -647,10 +655,10 @@ class VLANGroupTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
f"name,description",
|
f"id,name,description",
|
||||||
f"VLAN Group 7,Fourth VLAN group7",
|
f"{vlan_groups[0].pk},VLAN Group 7,Fourth VLAN group7",
|
||||||
f"VLAN Group 8,Fifth VLAN group8",
|
f"{vlan_groups[1].pk},VLAN Group 8,Fifth VLAN group8",
|
||||||
f"VLAN Group 9,Sixth VLAN group9",
|
f"{vlan_groups[2].pk},VLAN Group 9,Sixth VLAN group9",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
@ -682,11 +690,12 @@ class VLANTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
Role.objects.bulk_create(roles)
|
Role.objects.bulk_create(roles)
|
||||||
|
|
||||||
VLAN.objects.bulk_create([
|
vlans = (
|
||||||
VLAN(group=vlangroups[0], vid=101, name='VLAN101', site=sites[0], role=roles[0]),
|
VLAN(group=vlangroups[0], vid=101, name='VLAN101', site=sites[0], role=roles[0]),
|
||||||
VLAN(group=vlangroups[0], vid=102, name='VLAN102', site=sites[0], role=roles[0]),
|
VLAN(group=vlangroups[0], vid=102, name='VLAN102', site=sites[0], role=roles[0]),
|
||||||
VLAN(group=vlangroups[0], vid=103, name='VLAN103', site=sites[0], role=roles[0]),
|
VLAN(group=vlangroups[0], vid=103, name='VLAN103', site=sites[0], role=roles[0]),
|
||||||
])
|
)
|
||||||
|
VLAN.objects.bulk_create(vlans)
|
||||||
|
|
||||||
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
||||||
|
|
||||||
@ -710,10 +719,10 @@ class VLANTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
"name,description",
|
"id,name,description",
|
||||||
"VLAN107,New description 7",
|
f"{vlans[0].pk},VLAN107,New description 7",
|
||||||
"VLAN108,New description 8",
|
f"{vlans[1].pk},VLAN108,New description 8",
|
||||||
"VLAN109,New description 9",
|
f"{vlans[2].pk},VLAN109,New description 9",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
@ -731,11 +740,12 @@ class ServiceTemplateTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpTestData(cls):
|
def setUpTestData(cls):
|
||||||
ServiceTemplate.objects.bulk_create([
|
service_templates = (
|
||||||
ServiceTemplate(name='Service Template 1', protocol=ServiceProtocolChoices.PROTOCOL_TCP, ports=[101]),
|
ServiceTemplate(name='Service Template 1', protocol=ServiceProtocolChoices.PROTOCOL_TCP, ports=[101]),
|
||||||
ServiceTemplate(name='Service Template 2', protocol=ServiceProtocolChoices.PROTOCOL_TCP, ports=[102]),
|
ServiceTemplate(name='Service Template 2', protocol=ServiceProtocolChoices.PROTOCOL_TCP, ports=[102]),
|
||||||
ServiceTemplate(name='Service Template 3', protocol=ServiceProtocolChoices.PROTOCOL_TCP, ports=[103]),
|
ServiceTemplate(name='Service Template 3', protocol=ServiceProtocolChoices.PROTOCOL_TCP, ports=[103]),
|
||||||
])
|
)
|
||||||
|
ServiceTemplate.objects.bulk_create(service_templates)
|
||||||
|
|
||||||
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
||||||
|
|
||||||
@ -755,10 +765,10 @@ class ServiceTemplateTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
"name,description",
|
"id,name,description",
|
||||||
"Service Template 7,First service template7",
|
f"{service_templates[0].pk},Service Template 7,First service template7",
|
||||||
"Service Template 8,Second service template8",
|
f"{service_templates[1].pk},Service Template 8,Second service template8",
|
||||||
"Service Template 9,Third service template9",
|
f"{service_templates[2].pk},Service Template 9,Third service template9",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
@ -780,11 +790,12 @@ class ServiceTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
devicerole = DeviceRole.objects.create(name='Device Role 1', slug='device-role-1')
|
devicerole = DeviceRole.objects.create(name='Device Role 1', slug='device-role-1')
|
||||||
device = Device.objects.create(name='Device 1', site=site, device_type=devicetype, device_role=devicerole)
|
device = Device.objects.create(name='Device 1', site=site, device_type=devicetype, device_role=devicerole)
|
||||||
|
|
||||||
Service.objects.bulk_create([
|
services = (
|
||||||
Service(device=device, name='Service 1', protocol=ServiceProtocolChoices.PROTOCOL_TCP, ports=[101]),
|
Service(device=device, name='Service 1', protocol=ServiceProtocolChoices.PROTOCOL_TCP, ports=[101]),
|
||||||
Service(device=device, name='Service 2', protocol=ServiceProtocolChoices.PROTOCOL_TCP, ports=[102]),
|
Service(device=device, name='Service 2', protocol=ServiceProtocolChoices.PROTOCOL_TCP, ports=[102]),
|
||||||
Service(device=device, name='Service 3', protocol=ServiceProtocolChoices.PROTOCOL_TCP, ports=[103]),
|
Service(device=device, name='Service 3', protocol=ServiceProtocolChoices.PROTOCOL_TCP, ports=[103]),
|
||||||
])
|
)
|
||||||
|
Service.objects.bulk_create(services)
|
||||||
|
|
||||||
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
||||||
|
|
||||||
@ -807,10 +818,10 @@ class ServiceTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
"name,description",
|
"id,name,description",
|
||||||
"Service 7,First service7",
|
f"{services[0].pk},Service 7,First service7",
|
||||||
"Service 8,Second service8",
|
f"{services[1].pk},Service 8,Second service8",
|
||||||
"Service 9,Third service9",
|
f"{services[2].pk},Service 9,Third service9",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {
|
cls.bulk_edit_data = {
|
||||||
@ -849,21 +860,6 @@ class ServiceTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
|
|
||||||
class L2VPNTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
class L2VPNTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||||
model = L2VPN
|
model = L2VPN
|
||||||
csv_data = (
|
|
||||||
'name,slug,type,identifier',
|
|
||||||
'L2VPN 5,l2vpn-5,vxlan,456',
|
|
||||||
'L2VPN 6,l2vpn-6,vxlan,444',
|
|
||||||
)
|
|
||||||
|
|
||||||
csv_update_data = (
|
|
||||||
'name,description',
|
|
||||||
'L2VPN 7,New description 7',
|
|
||||||
'L2VPN 8,New description 8',
|
|
||||||
)
|
|
||||||
|
|
||||||
bulk_edit_data = {
|
|
||||||
'description': 'New Description',
|
|
||||||
}
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpTestData(cls):
|
def setUpTestData(cls):
|
||||||
@ -878,9 +874,24 @@ class L2VPNTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
L2VPN(name='L2VPN 2', slug='l2vpn-2', type=L2VPNTypeChoices.TYPE_VXLAN, identifier='650002'),
|
L2VPN(name='L2VPN 2', slug='l2vpn-2', type=L2VPNTypeChoices.TYPE_VXLAN, identifier='650002'),
|
||||||
L2VPN(name='L2VPN 3', slug='l2vpn-3', type=L2VPNTypeChoices.TYPE_VXLAN, identifier='650003')
|
L2VPN(name='L2VPN 3', slug='l2vpn-3', type=L2VPNTypeChoices.TYPE_VXLAN, identifier='650003')
|
||||||
)
|
)
|
||||||
|
|
||||||
L2VPN.objects.bulk_create(l2vpns)
|
L2VPN.objects.bulk_create(l2vpns)
|
||||||
|
|
||||||
|
cls.csv_data = (
|
||||||
|
'name,slug,type,identifier',
|
||||||
|
'L2VPN 5,l2vpn-5,vxlan,456',
|
||||||
|
'L2VPN 6,l2vpn-6,vxlan,444',
|
||||||
|
)
|
||||||
|
|
||||||
|
cls.csv_update_data = (
|
||||||
|
'id,name,description',
|
||||||
|
f'{l2vpns[0].pk},L2VPN 7,New description 7',
|
||||||
|
f'{l2vpns[1].pk},L2VPN 8,New description 8',
|
||||||
|
)
|
||||||
|
|
||||||
|
cls.bulk_edit_data = {
|
||||||
|
'description': 'New Description',
|
||||||
|
}
|
||||||
|
|
||||||
cls.form_data = {
|
cls.form_data = {
|
||||||
'name': 'L2VPN 8',
|
'name': 'L2VPN 8',
|
||||||
'slug': 'l2vpn-8',
|
'slug': 'l2vpn-8',
|
||||||
@ -943,10 +954,10 @@ class L2VPNTerminationTestCase(
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
"l2vpn",
|
"id,l2vpn",
|
||||||
"L2VPN 2",
|
f"{terminations[0].pk},L2VPN 2",
|
||||||
"L2VPN 2",
|
f"{terminations[1].pk},L2VPN 2",
|
||||||
"L2VPN 2",
|
f"{terminations[2].pk},L2VPN 2",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.bulk_edit_data = {}
|
cls.bulk_edit_data = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user