|
|
@@ -638,8 +638,8 @@ class DeviceTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
|
|
|
|
|
|
device_types = (
|
|
|
DeviceType(manufacturer=manufacturers[0], model='Model 1', slug='model-1', part_number='Part Number 1', u_height=1, is_full_depth=True),
|
|
|
- DeviceType(manufacturer=manufacturers[1], model='Model 2', slug='model-2', part_number='Part Number 2', u_height=2, is_full_depth=True, subdevice_role=SubdeviceRoleChoices.ROLE_PARENT),
|
|
|
- DeviceType(manufacturer=manufacturers[2], model='Model 3', slug='model-3', part_number='Part Number 3', u_height=3, is_full_depth=False, subdevice_role=SubdeviceRoleChoices.ROLE_CHILD),
|
|
|
+ DeviceType(manufacturer=manufacturers[1], model='Model 2', slug='model-2', part_number='Part Number 2', u_height=2, is_full_depth=True, subdevice_role=SubdeviceRoleChoices.ROLE_PARENT, airflow=DeviceAirflowChoices.AIRFLOW_FRONT_TO_REAR),
|
|
|
+ DeviceType(manufacturer=manufacturers[2], model='Model 3', slug='model-3', part_number='Part Number 3', u_height=3, is_full_depth=False, subdevice_role=SubdeviceRoleChoices.ROLE_CHILD, airflow=DeviceAirflowChoices.AIRFLOW_REAR_TO_FRONT),
|
|
|
)
|
|
|
DeviceType.objects.bulk_create(device_types)
|
|
|
|
|
|
@@ -704,6 +704,10 @@ class DeviceTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
|
|
|
params = {'subdevice_role': SubdeviceRoleChoices.ROLE_PARENT}
|
|
|
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1)
|
|
|
|
|
|
+ def test_airflow(self):
|
|
|
+ params = {'airflow': DeviceAirflowChoices.AIRFLOW_FRONT_TO_REAR}
|
|
|
+ self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1)
|
|
|
+
|
|
|
def test_manufacturer(self):
|
|
|
manufacturers = Manufacturer.objects.all()[:2]
|
|
|
params = {'manufacturer_id': [manufacturers[0].pk, manufacturers[1].pk]}
|
|
|
@@ -1235,8 +1239,8 @@ class DeviceTestCase(TestCase, ChangeLoggedFilterSetTests):
|
|
|
|
|
|
devices = (
|
|
|
Device(name='Device 1', device_type=device_types[0], device_role=device_roles[0], platform=platforms[0], tenant=tenants[0], serial='ABC', asset_tag='1001', site=sites[0], location=locations[0], rack=racks[0], position=1, face=DeviceFaceChoices.FACE_FRONT, status=DeviceStatusChoices.STATUS_ACTIVE, cluster=clusters[0], local_context_data={"foo": 123}),
|
|
|
- Device(name='Device 2', device_type=device_types[1], device_role=device_roles[1], platform=platforms[1], tenant=tenants[1], serial='DEF', asset_tag='1002', site=sites[1], location=locations[1], rack=racks[1], position=2, face=DeviceFaceChoices.FACE_FRONT, status=DeviceStatusChoices.STATUS_STAGED, cluster=clusters[1]),
|
|
|
- Device(name='Device 3', device_type=device_types[2], device_role=device_roles[2], platform=platforms[2], tenant=tenants[2], serial='GHI', asset_tag='1003', site=sites[2], location=locations[2], rack=racks[2], position=3, face=DeviceFaceChoices.FACE_REAR, status=DeviceStatusChoices.STATUS_FAILED, cluster=clusters[2]),
|
|
|
+ Device(name='Device 2', device_type=device_types[1], device_role=device_roles[1], platform=platforms[1], tenant=tenants[1], serial='DEF', asset_tag='1002', site=sites[1], location=locations[1], rack=racks[1], position=2, face=DeviceFaceChoices.FACE_FRONT, status=DeviceStatusChoices.STATUS_STAGED, airflow=DeviceAirflowChoices.AIRFLOW_FRONT_TO_REAR, cluster=clusters[1]),
|
|
|
+ Device(name='Device 3', device_type=device_types[2], device_role=device_roles[2], platform=platforms[2], tenant=tenants[2], serial='GHI', asset_tag='1003', site=sites[2], location=locations[2], rack=racks[2], position=3, face=DeviceFaceChoices.FACE_REAR, status=DeviceStatusChoices.STATUS_FAILED, airflow=DeviceAirflowChoices.AIRFLOW_REAR_TO_FRONT, cluster=clusters[2]),
|
|
|
)
|
|
|
Device.objects.bulk_create(devices)
|
|
|
|
|
|
@@ -1390,6 +1394,10 @@ class DeviceTestCase(TestCase, ChangeLoggedFilterSetTests):
|
|
|
params = {'is_full_depth': 'false'}
|
|
|
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1)
|
|
|
|
|
|
+ def test_airflow(self):
|
|
|
+ params = {'airflow': DeviceAirflowChoices.AIRFLOW_FRONT_TO_REAR}
|
|
|
+ self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1)
|
|
|
+
|
|
|
def test_mac_address(self):
|
|
|
params = {'mac_address': ['00-00-00-00-00-01', '00-00-00-00-00-02']}
|
|
|
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|