feat(dcim): Add Device filtering by location slug in tests

Extend test cases to include filtering by location slug. Ensures the
FilterSet works correctly with slug-based queries for locations.

Fixes #19056
This commit is contained in:
Martin Hauser 2025-04-13 14:51:23 +02:00
parent c1da23f0f6
commit 92dd3b0573
No known key found for this signature in database

View File

@ -2561,6 +2561,8 @@ class DeviceTestCase(TestCase, ChangeLoggedFilterSetTests):
locations = Location.objects.all()[:2] locations = Location.objects.all()[:2]
params = {'location_id': [locations[0].pk, locations[1].pk]} params = {'location_id': [locations[0].pk, locations[1].pk]}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
params = {'location': [locations[0].slug, locations[1].slug]}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
def test_rack(self): def test_rack(self):
racks = Rack.objects.all()[:2] racks = Rack.objects.all()[:2]