From 8e57521f3e651be5f0d13c2700e80e5ffc5c8405 Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 26 Jun 2023 09:32:47 -0700 Subject: [PATCH] 12589 objectpermission test fixes for create check where create new objectpermission --- netbox/utilities/testing/views.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/netbox/utilities/testing/views.py b/netbox/utilities/testing/views.py index c4b642450..a066d822d 100644 --- a/netbox/utilities/testing/views.py +++ b/netbox/utilities/testing/views.py @@ -175,6 +175,10 @@ class ViewTestCases: 'data': post_data(self.form_data), } self.assertHttpStatus(self.client.post(**request), 302) + + if self.model == ObjectPermission: + # if this test is for ObjectPermission we just created another one + initial_count += 1 self.assertEqual(initial_count + 1, self._get_queryset().count()) instance = self._get_queryset().order_by('pk').last() self.assertInstanceEqual(instance, self.form_data, exclude=['password']) @@ -211,6 +215,9 @@ class ViewTestCases: 'data': post_data(self.form_data), } self.assertHttpStatus(self.client.post(**request), 200) + if self.model == ObjectPermission: + # if this test is for ObjectPermission we just created another one + initial_count += 1 self.assertEqual(initial_count, self._get_queryset().count()) # Check that no object was created # Update the ObjectPermission to allow creation