From 7a858cea23cee1d9ea1eb558b2f987338e16e841 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 8 Jun 2020 15:58:54 -0400 Subject: [PATCH] Extend test_bulk_create_objects() to inspect created objects --- netbox/utilities/testing/api.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/netbox/utilities/testing/api.py b/netbox/utilities/testing/api.py index 1e2063a6d..ce4f1d1e5 100644 --- a/netbox/utilities/testing/api.py +++ b/netbox/utilities/testing/api.py @@ -199,7 +199,10 @@ class APIViewTestCases: initial_count = self.model.objects.count() response = self.client.post(self._get_list_url(), self.create_data, format='json', **self.header) self.assertHttpStatus(response, status.HTTP_201_CREATED) + self.assertEqual(len(response.data), len(self.create_data)) self.assertEqual(self.model.objects.count(), initial_count + len(self.create_data)) + for i, obj in enumerate(response.data): + self.assertInstanceEqual(self.model.objects.get(pk=obj['id']), self.create_data[i], api=True) class UpdateObjectViewTestCase(APITestCase): update_data = {}