Parcourir la source

Added status field to DeviceTestCase tests (Django 1.10 BooleanField issue)

Jeremy Stretch il y a 8 ans
Parent
commit
1f4d5b84b3
1 fichiers modifiés avec 28 ajouts et 20 suppressions
  1. 28 20
      netbox/dcim/tests/test_forms.py

+ 28 - 20
netbox/dcim/tests/test_forms.py

@@ -13,59 +13,67 @@ class DeviceTestCase(TestCase):
 
     def test_racked_device(self):
         test = DeviceForm(data={
-            'device_role': get_id(DeviceRole, 'leaf-switch'),
             'name': 'test',
+            'device_role': get_id(DeviceRole, 'leaf-switch'),
+            'tenant': None,
+            'manufacturer': get_id(Manufacturer, 'juniper'),
+            'device_type': get_id(DeviceType, 'qfx5100-48s'),
             'site': get_id(Site, 'test1'),
+            'rack': '1',
             'face': RACK_FACE_FRONT,
-            'platform': get_id(Platform, 'juniper-junos'),
-            'device_type': get_id(DeviceType, 'qfx5100-48s'),
             'position': 41,
-            'rack': '1',
-            'manufacturer': get_id(Manufacturer, 'juniper'),
+            'platform': get_id(Platform, 'juniper-junos'),
+            'status': STATUS_ACTIVE,
         })
         self.assertTrue(test.is_valid(), test.fields['position'].choices)
         self.assertTrue(test.save())
 
     def test_racked_device_occupied(self):
         test = DeviceForm(data={
-            'device_role': get_id(DeviceRole, 'leaf-switch'),
             'name': 'test',
+            'device_role': get_id(DeviceRole, 'leaf-switch'),
+            'tenant': None,
+            'manufacturer': get_id(Manufacturer, 'juniper'),
+            'device_type': get_id(DeviceType, 'qfx5100-48s'),
             'site': get_id(Site, 'test1'),
+            'rack': '1',
             'face': RACK_FACE_FRONT,
-            'platform': get_id(Platform, 'juniper-junos'),
-            'device_type': get_id(DeviceType, 'qfx5100-48s'),
             'position': 1,
-            'rack': '1',
-            'manufacturer': get_id(Manufacturer, 'juniper'),
+            'platform': get_id(Platform, 'juniper-junos'),
+            'status': STATUS_ACTIVE,
         })
         self.assertFalse(test.is_valid())
 
     def test_non_racked_device(self):
         test = DeviceForm(data={
-            'device_role': get_id(DeviceRole, 'pdu'),
             'name': 'test',
+            'device_role': get_id(DeviceRole, 'pdu'),
+            'tenant': None,
+            'manufacturer': get_id(Manufacturer, 'servertech'),
+            'device_type': get_id(DeviceType, 'cwg-24vym415c9'),
             'site': get_id(Site, 'test1'),
+            'rack': '1',
             'face': None,
-            'platform': None,
-            'device_type': get_id(DeviceType, 'cwg-24vym415c9'),
             'position': None,
-            'rack': '1',
-            'manufacturer': get_id(Manufacturer, 'servertech'),
+            'platform': None,
+            'status': STATUS_ACTIVE,
         })
         self.assertTrue(test.is_valid())
         self.assertTrue(test.save())
 
     def test_non_racked_device_with_face(self):
         test = DeviceForm(data={
-            'device_role': get_id(DeviceRole, 'pdu'),
             'name': 'test',
+            'device_role': get_id(DeviceRole, 'pdu'),
+            'tenant': None,
+            'manufacturer': get_id(Manufacturer, 'servertech'),
+            'device_type': get_id(DeviceType, 'cwg-24vym415c9'),
             'site': get_id(Site, 'test1'),
+            'rack': '1',
             'face': RACK_FACE_REAR,
-            'platform': None,
-            'device_type': get_id(DeviceType, 'cwg-24vym415c9'),
             'position': None,
-            'rack': '1',
-            'manufacturer': get_id(Manufacturer, 'servertech'),
+            'platform': None,
+            'status': STATUS_ACTIVE,
         })
         self.assertTrue(test.is_valid())
         self.assertTrue(test.save())