mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-08 00:28:16 -06:00
17058 fix tests
This commit is contained in:
parent
bcb99cdacd
commit
6b9d1ddb93
@ -276,7 +276,7 @@ class RackRoleTest(APIViewTestCases.APIViewTestCase):
|
||||
|
||||
class RackTypeTest(APIViewTestCases.APIViewTestCase):
|
||||
model = RackType
|
||||
brief_fields = ['description', 'display', 'id', 'manufacturer', 'name', 'slug', 'url']
|
||||
brief_fields = ['description', 'display', 'id', 'manufacturer', 'model', 'slug', 'url']
|
||||
bulk_update_data = {
|
||||
'description': 'new description',
|
||||
}
|
||||
@ -290,26 +290,26 @@ class RackTypeTest(APIViewTestCases.APIViewTestCase):
|
||||
Manufacturer.objects.bulk_create(manufacturers)
|
||||
|
||||
rack_types = (
|
||||
RackType(manufacturer=manufacturers[0], name='Rack Type 1', slug='rack-type-1'),
|
||||
RackType(manufacturer=manufacturers[0], name='Rack Type 2', slug='rack-type-2'),
|
||||
RackType(manufacturer=manufacturers[0], name='Rack Type 3', slug='rack-type-3'),
|
||||
RackType(manufacturer=manufacturers[0], model='Rack Type 1', slug='rack-type-1'),
|
||||
RackType(manufacturer=manufacturers[0], model='Rack Type 2', slug='rack-type-2'),
|
||||
RackType(manufacturer=manufacturers[0], model='Rack Type 3', slug='rack-type-3'),
|
||||
)
|
||||
RackType.objects.bulk_create(rack_types)
|
||||
|
||||
cls.create_data = [
|
||||
{
|
||||
'manufacturer': manufacturers[1].pk,
|
||||
'name': 'Rack Type 4',
|
||||
'model': 'Rack Type 4',
|
||||
'slug': 'rack-type-4',
|
||||
},
|
||||
{
|
||||
'manufacturer': manufacturers[1].pk,
|
||||
'name': 'Rack Type 5',
|
||||
'model': 'Rack Type 5',
|
||||
'slug': 'rack-type-5',
|
||||
},
|
||||
{
|
||||
'manufacturer': manufacturers[1].pk,
|
||||
'name': 'Rack Type 6',
|
||||
'model': 'Rack Type 6',
|
||||
'slug': 'rack-type-6',
|
||||
},
|
||||
]
|
||||
|
@ -484,7 +484,7 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
racks = (
|
||||
RackType(
|
||||
manufacturer=manufacturers[0],
|
||||
name='RackType 1',
|
||||
model='RackType 1',
|
||||
slug='rack-type-1',
|
||||
form_factor=RackFormFactorChoices.TYPE_2POST,
|
||||
width=RackWidthChoices.WIDTH_19IN,
|
||||
@ -502,7 +502,7 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
),
|
||||
RackType(
|
||||
manufacturer=manufacturers[1],
|
||||
name='RackType 2',
|
||||
model='RackType 2',
|
||||
slug='rack-type-2',
|
||||
form_factor=RackFormFactorChoices.TYPE_4POST,
|
||||
width=RackWidthChoices.WIDTH_21IN,
|
||||
@ -520,7 +520,7 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
),
|
||||
RackType(
|
||||
manufacturer=manufacturers[2],
|
||||
name='RackType 3',
|
||||
model='RackType 3',
|
||||
slug='rack-type-3',
|
||||
form_factor=RackFormFactorChoices.TYPE_CABINET,
|
||||
width=RackWidthChoices.WIDTH_23IN,
|
||||
@ -550,8 +550,8 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
params = {'manufacturer': [manufacturers[0].slug, manufacturers[1].slug]}
|
||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
||||
|
||||
def test_name(self):
|
||||
params = {'name': ['RackType 1', 'RackType 2']}
|
||||
def test_model(self):
|
||||
params = {'model': ['RackType 1', 'RackType 2']}
|
||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
||||
|
||||
def test_slug(self):
|
||||
|
@ -348,9 +348,9 @@ class RackTypeTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
Manufacturer.objects.bulk_create(manufacturers)
|
||||
|
||||
rack_types = (
|
||||
RackType(manufacturer=manufacturers[0], name='RackType 1', slug='rack-type-1',),
|
||||
RackType(manufacturer=manufacturers[0], name='RackType 2', slug='rack-type-2',),
|
||||
RackType(manufacturer=manufacturers[0], name='RackType 3', slug='rack-type-3',),
|
||||
RackType(manufacturer=manufacturers[0], model='RackType 1', slug='rack-type-1',),
|
||||
RackType(manufacturer=manufacturers[0], model='RackType 2', slug='rack-type-2',),
|
||||
RackType(manufacturer=manufacturers[0], model='RackType 3', slug='rack-type-3',),
|
||||
)
|
||||
RackType.objects.bulk_create(rack_types)
|
||||
|
||||
@ -358,7 +358,7 @@ class RackTypeTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
|
||||
cls.form_data = {
|
||||
'manufacturer': manufacturers[1].pk,
|
||||
'name': 'RackType X',
|
||||
'model': 'RackType X',
|
||||
'slug': 'rack-type-x',
|
||||
'type': RackFormFactorChoices.TYPE_CABINET,
|
||||
'width': RackWidthChoices.WIDTH_19IN,
|
||||
@ -376,14 +376,14 @@ class RackTypeTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
}
|
||||
|
||||
cls.csv_data = (
|
||||
"manufacturer,name,slug,width,u_height,weight,max_weight,weight_unit",
|
||||
"manufacturer,model,slug,width,u_height,weight,max_weight,weight_unit",
|
||||
"Manufacturer 1,RackType 4,rack-type-4,19,42,100,2000,kg",
|
||||
"Manufacturer 1,RackType 5,rack-type-5,19,42,100,2000,kg",
|
||||
"Manufacturer 1,RackType 6,rack-type-6,19,42,100,2000,kg",
|
||||
)
|
||||
|
||||
cls.csv_update_data = (
|
||||
"id,name",
|
||||
"id,model",
|
||||
f"{rack_types[0].pk},RackType 7",
|
||||
f"{rack_types[1].pk},RackType 8",
|
||||
f"{rack_types[2].pk},RackType 9",
|
||||
|
Loading…
Reference in New Issue
Block a user