فهرست منبع

Recreate the model instance instead of re-saving a deleted model
Same end result, but easier to read

Sander Steffann 5 سال پیش
والد
کامیت
3278cc8cc0
1فایلهای تغییر یافته به همراه8 افزوده شده و 0 حذف شده
  1. 8 0
      netbox/dcim/tests/test_models.py

+ 8 - 0
netbox/dcim/tests/test_models.py

@@ -601,6 +601,10 @@ class CablePathTestCase(TestCase):
         self.assertIsNone(endpoint_b.connection_status)
         self.assertIsNone(endpoint_b.connection_status)
 
 
         # Recreate cable 1 to test creating the cables in reverse order (RP first, FP second)
         # Recreate cable 1 to test creating the cables in reverse order (RP first, FP second)
+        cable1 = Cable(
+            termination_a=Interface.objects.get(device__name='Device 1', name='Interface 1'),
+            termination_b=FrontPort.objects.get(device__name='Panel 5', name='Front Port 1')
+        )
         cable1.save()
         cable1.save()
 
 
         # Refresh endpoints
         # Refresh endpoints
@@ -712,6 +716,10 @@ class CablePathTestCase(TestCase):
         self.assertIsNone(endpoint_d.connection_status)
         self.assertIsNone(endpoint_d.connection_status)
 
 
         # Recreate cable 3 to test reverse order (Panel 5 FP first, RP second)
         # Recreate cable 3 to test reverse order (Panel 5 FP first, RP second)
+        cable3 = Cable(
+            termination_b=RearPort.objects.get(device__name='Panel 1', name='Rear Port 1'),
+            termination_a=RearPort.objects.get(device__name='Panel 5', name='Rear Port 1')
+        )
         cable3.save()
         cable3.save()
 
 
         # Refresh endpoints
         # Refresh endpoints