9627 test fixes

This commit is contained in:
Arthur Hanson 2024-06-21 14:19:10 -07:00
parent f509ca4e5e
commit 226312631a
2 changed files with 3 additions and 3 deletions

View File

@ -27,7 +27,7 @@ class NumericRangeArraySerializer(serializers.BaseSerializer):
return string_to_range_array(data)
def to_representation(self, instance):
return ranges_to_string(data)
return ranges_to_string(instance)
class VLANGroupSerializer(NetBoxModelSerializer):
@ -46,7 +46,7 @@ class VLANGroupSerializer(NetBoxModelSerializer):
# Related object counts
vlan_count = RelatedObjectCountField('vlans')
vlan_id_ranges = NumericRangeArraySerializer()
vlan_id_ranges = NumericRangeArraySerializer(required=False)
class Meta:
model = VLANGroup

View File

@ -140,7 +140,7 @@ def ranges_to_string(ranges):
For example:
[1-100, 200-300] => "1-100, 200-300"
"""
return ', '.join([f"{val.lower}-{val.upper}" for val in value])
return ', '.join([f"{val.lower}-{val.upper}" for val in ranges])
def string_to_range_array(value):