mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fix ID list creation in API tests
This commit is contained in:
@ -345,7 +345,7 @@ class APIViewTestCases:
|
||||
obj_perm.users.add(self.user)
|
||||
obj_perm.object_types.add(ContentType.objects.get_for_model(self.model))
|
||||
|
||||
id_list = self._get_queryset().values_list('id', flat=True)[:3]
|
||||
id_list = list(self._get_queryset().values_list('id', flat=True)[:3])
|
||||
self.assertEqual(len(id_list), 3, "Insufficient number of objects to test bulk update")
|
||||
data = [
|
||||
{'id': id, **self.bulk_update_data} for id in id_list
|
||||
@ -416,7 +416,7 @@ class APIViewTestCases:
|
||||
|
||||
# Target the three most recently created objects to avoid triggering recursive deletions
|
||||
# (e.g. with MPTT objects)
|
||||
id_list = self._get_queryset().order_by('-id').values_list('id', flat=True)[:3]
|
||||
id_list = list(self._get_queryset().order_by('-id').values_list('id', flat=True)[:3])
|
||||
self.assertEqual(len(id_list), 3, "Insufficient number of objects to test bulk deletion")
|
||||
data = [{"id": id} for id in id_list]
|
||||
|
||||
|
Reference in New Issue
Block a user