1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Add a description field to all organizational models

This commit is contained in:
Jeremy Stretch
2020-03-13 16:24:37 -04:00
parent 3b4ec5926d
commit cebe580484
28 changed files with 213 additions and 116 deletions

View File

@@ -20,9 +20,9 @@ class TenantGroupTestCase(TestCase):
tenantgroup.save()
tenant_groups = (
TenantGroup(name='Tenant Group 1', slug='tenant-group-1', parent=parent_tenant_groups[0]),
TenantGroup(name='Tenant Group 2', slug='tenant-group-2', parent=parent_tenant_groups[1]),
TenantGroup(name='Tenant Group 3', slug='tenant-group-3', parent=parent_tenant_groups[2]),
TenantGroup(name='Tenant Group 1', slug='tenant-group-1', parent=parent_tenant_groups[0], description='A'),
TenantGroup(name='Tenant Group 2', slug='tenant-group-2', parent=parent_tenant_groups[1], description='B'),
TenantGroup(name='Tenant Group 3', slug='tenant-group-3', parent=parent_tenant_groups[2], description='C'),
)
for tenantgroup in tenant_groups:
tenantgroup.save()
@@ -40,6 +40,10 @@ class TenantGroupTestCase(TestCase):
params = {'slug': ['tenant-group-1', 'tenant-group-2']}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
def test_description(self):
params = {'description': ['A', 'B']}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
def test_parent(self):
parent_groups = TenantGroup.objects.filter(name__startswith='Parent')[:2]
params = {'parent_id': [parent_groups[0].pk, parent_groups[1].pk]}

View File

@@ -19,13 +19,14 @@ class TenantGroupTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
cls.form_data = {
'name': 'Tenant Group X',
'slug': 'tenant-group-x',
'description': 'A new tenant group',
}
cls.csv_data = (
"name,slug",
"Tenant Group 4,tenant-group-4",
"Tenant Group 5,tenant-group-5",
"Tenant Group 6,tenant-group-6",
"name,slug,description",
"Tenant Group 4,tenant-group-4,Fourth tenant group",
"Tenant Group 5,tenant-group-5,Fifth tenant group",
"Tenant Group 6,tenant-group-6,Sixth tenant group",
)