Arthur пре 2 дана
родитељ
комит
98fd936eba
2 измењених фајлова са 0 додато и 50 уклоњено
  1. 0 42
      netbox/dcim/tests/test_models.py
  2. 0 8
      netbox/dcim/tests/test_normalization.py

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

@@ -24,10 +24,8 @@ from netbox.choices import DiameterUnitChoices, FlowRateUnitChoices, WeightUnitC
 from netbox.context_managers import event_tracking
 from tenancy.models import Tenant
 from users.models import User
-from utilities.conversion import to_grams
 from utilities.data import drange
 from utilities.testing import create_test_device, create_test_image
-from utilities.testing.mixins import NormalizedMeasurementTestMixin
 from virtualization.models import Cluster, ClusterType
 
 
@@ -227,28 +225,6 @@ class DeviceTypeTestCase(TestCase):
         self.assertEqual(device_type.interface_template_count, 1)
 
 
-class DeviceTypeWeightTestCase(NormalizedMeasurementTestMixin, TestCase):
-    model = DeviceType
-    value_field = 'weight'
-    unit_field = 'weight_unit'
-    normalized_field = '_abs_weight'
-    unit_choices = WeightUnitChoices
-    converter = staticmethod(to_grams)
-
-    @classmethod
-    def setUpTestData(cls):
-        cls.manufacturer = Manufacturer.objects.create(name='Manufacturer 1', slug='manufacturer-1')
-
-    def create_instance(self, **attrs):
-        index = next(self.sequence)
-        return DeviceType(
-            manufacturer=self.manufacturer,
-            model=f'Device Type {index}',
-            slug=f'device-type-{index}',
-            **attrs
-        )
-
-
 class DeviceTypeImageTestCase(TestCase):
     """
     Test the handling of DeviceType front/rear image files.
@@ -605,24 +581,6 @@ class RackTypeTestCase(TestCase):
         self.assertEqual(rack.cooling_capacity, rack_type.cooling_capacity)
 
 
-class RackMaxWeightTestCase(NormalizedMeasurementTestMixin, TestCase):
-    model = Rack
-    value_field = 'max_weight'
-    unit_field = 'weight_unit'
-    normalized_field = '_abs_max_weight'
-    unit_choices = WeightUnitChoices
-    converter = staticmethod(to_grams)
-    # The largest value the integer column holds; multiplying it as an integer would overflow
-    value = 2147483647
-
-    @classmethod
-    def setUpTestData(cls):
-        cls.site = Site.objects.create(name='Site 1', slug='site-1')
-
-    def create_instance(self, **attrs):
-        return Rack(site=self.site, name=f'Rack {next(self.sequence)}', **attrs)
-
-
 class RackTestCase(TestCase):
 
     @classmethod

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

@@ -25,14 +25,6 @@ class MaxWeightTestMixin(WeightTestMixin):
     normalized_field = '_abs_max_weight'
     value = 123  # max_weight is an integer field
 
-    def test_large_value(self):
-        """
-        The normalized value of a large integer weight must not overflow integer arithmetic.
-        """
-        instance = self.create_instance(max_weight=3_000_000, weight_unit=WeightUnitChoices.UNIT_KILOGRAM)
-        instance.save()
-        self.assertNormalized(instance, 3_000_000, WeightUnitChoices.UNIT_KILOGRAM)
-
 
 class DiameterTestMixin(NormalizedMeasurementTestMixin):
     value_field = 'diameter'