|
|
@@ -681,11 +681,15 @@ class DeviceTypeTestCase(
|
|
|
"""
|
|
|
IMPORT_DATA = """
|
|
|
manufacturer: Generic
|
|
|
-default_platform: Platform
|
|
|
model: TEST-1000
|
|
|
slug: test-1000
|
|
|
+default_platform: Platform
|
|
|
u_height: 2
|
|
|
+is_full_depth: false
|
|
|
+airflow: front-to-rear
|
|
|
subdevice_role: parent
|
|
|
+weight: 10
|
|
|
+weight_unit: kg
|
|
|
comments: Test comment
|
|
|
console-ports:
|
|
|
- name: Console Port 1
|
|
|
@@ -794,8 +798,16 @@ inventory-items:
|
|
|
self.assertHttpStatus(response, 200)
|
|
|
|
|
|
device_type = DeviceType.objects.get(model='TEST-1000')
|
|
|
- self.assertEqual(device_type.comments, 'Test comment')
|
|
|
+ self.assertEqual(device_type.manufacturer.pk, manufacturer.pk)
|
|
|
self.assertEqual(device_type.default_platform.pk, platform.pk)
|
|
|
+ self.assertEqual(device_type.slug, 'test-1000')
|
|
|
+ self.assertEqual(device_type.u_height, 2)
|
|
|
+ self.assertFalse(device_type.is_full_depth)
|
|
|
+ self.assertEqual(device_type.airflow, DeviceAirflowChoices.AIRFLOW_FRONT_TO_REAR)
|
|
|
+ self.assertEqual(device_type.subdevice_role, SubdeviceRoleChoices.ROLE_PARENT)
|
|
|
+ self.assertEqual(device_type.weight, 10)
|
|
|
+ self.assertEqual(device_type.weight_unit, WeightUnitChoices.UNIT_KILOGRAM)
|
|
|
+ self.assertEqual(device_type.comments, 'Test comment')
|
|
|
|
|
|
# Verify all of the components were created
|
|
|
self.assertEqual(device_type.consoleporttemplates.count(), 3)
|
|
|
@@ -1019,6 +1031,8 @@ class ModuleTypeTestCase(
|
|
|
IMPORT_DATA = """
|
|
|
manufacturer: Generic
|
|
|
model: TEST-1000
|
|
|
+weight: 10
|
|
|
+weight_unit: lb
|
|
|
comments: Test comment
|
|
|
console-ports:
|
|
|
- name: Console Port 1
|
|
|
@@ -1082,7 +1096,8 @@ front-ports:
|
|
|
"""
|
|
|
|
|
|
# Create the manufacturer
|
|
|
- Manufacturer(name='Generic', slug='generic').save()
|
|
|
+ manufacturer = Manufacturer(name='Generic', slug='generic')
|
|
|
+ manufacturer.save()
|
|
|
|
|
|
# Add all required permissions to the test user
|
|
|
self.add_permissions(
|
|
|
@@ -1105,6 +1120,9 @@ front-ports:
|
|
|
self.assertHttpStatus(response, 200)
|
|
|
|
|
|
module_type = ModuleType.objects.get(model='TEST-1000')
|
|
|
+ self.assertEqual(module_type.manufacturer.pk, manufacturer.pk)
|
|
|
+ self.assertEqual(module_type.weight, 10)
|
|
|
+ self.assertEqual(module_type.weight_unit, WeightUnitChoices.UNIT_POUND)
|
|
|
self.assertEqual(module_type.comments, 'Test comment')
|
|
|
|
|
|
# Verify all the components were created
|