From d23b8a2d07bfc9a205e2244b88177d35a5a0b3d6 Mon Sep 17 00:00:00 2001 From: Jason Novinger Date: Fri, 11 Sep 2026 02:57:44 -0500 Subject: [PATCH] Populate bulk_update_invalid_data for circuits API tests Give each circuits test class an invalid payload so test_bulk_update_objects_validation_error runs instead of skipping. Four classes have neither a choice field nor a colour field on their serializer and use a nonexistent FK pk instead. owner is absent from the circuit termination, circuit group assignment and virtual circuit termination serializers, so it was only used where it is actually present. All 11 circuits API test classes now run the test. --- netbox/circuits/tests/test_api.py | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/netbox/circuits/tests/test_api.py b/netbox/circuits/tests/test_api.py index 81d609847..3fe724b6b 100644 --- a/netbox/circuits/tests/test_api.py +++ b/netbox/circuits/tests/test_api.py @@ -23,6 +23,9 @@ class ProviderTestCase(APIViewTestCases.APIViewTestCase): bulk_update_data = { 'comments': 'New comments', } + bulk_update_invalid_data = { + 'owner': 99999, + } @classmethod def setUpTestData(cls): @@ -79,6 +82,9 @@ class CircuitTypeTestCase(APIViewTestCases.APIViewTestCase): bulk_update_data = { 'description': 'New description', } + bulk_update_invalid_data = { + 'color': 'not-a-color', + } @classmethod def setUpTestData(cls): @@ -97,6 +103,9 @@ class CircuitTestCase(APIViewTestCases.APIViewTestCase): bulk_update_data = { 'status': 'planned', } + bulk_update_invalid_data = { + 'status': 'not-a-valid-status', + } user_permissions = ('circuits.view_provider', 'circuits.view_circuittype') @classmethod @@ -215,6 +224,9 @@ class CircuitTerminationTestCase(APIViewTestCases.APIViewTestCase): cls.bulk_update_data = { 'port_speed': 123456 } + cls.bulk_update_invalid_data = { + 'term_side': 'not-a-valid-term-side', + } class CircuitGroupTestCase(APIViewTestCases.APIViewTestCase): @@ -223,6 +235,9 @@ class CircuitGroupTestCase(APIViewTestCases.APIViewTestCase): bulk_update_data = { 'description': 'New description', } + bulk_update_invalid_data = { + 'tenant': 99999, + } @classmethod def setUpTestData(cls): @@ -291,6 +306,9 @@ class ProviderAccountTestCase(APIViewTestCases.APIViewTestCase): 'provider': providers[1].pk, 'description': 'New description', } + cls.bulk_update_invalid_data = { + 'provider': 99999, + } class CircuitGroupAssignmentTestCase(APIViewTestCases.APIViewTestCase): @@ -299,6 +317,9 @@ class CircuitGroupAssignmentTestCase(APIViewTestCases.APIViewTestCase): bulk_update_data = { 'priority': CircuitPriorityChoices.PRIORITY_INACTIVE, } + bulk_update_invalid_data = { + 'priority': 'not-a-valid-priority', + } user_permissions = ('circuits.view_circuit', 'circuits.view_circuitgroup') @classmethod @@ -407,6 +428,9 @@ class ProviderNetworkTestCase(APIViewTestCases.APIViewTestCase): 'provider': providers[1].pk, 'description': 'New description', } + cls.bulk_update_invalid_data = { + 'provider': 99999, + } class VirtualCircuitTypeTestCase(APIViewTestCases.APIViewTestCase): @@ -429,6 +453,9 @@ class VirtualCircuitTypeTestCase(APIViewTestCases.APIViewTestCase): bulk_update_data = { 'description': 'New description', } + bulk_update_invalid_data = { + 'color': 'not-a-color', + } @classmethod def setUpTestData(cls): @@ -447,6 +474,9 @@ class VirtualCircuitTestCase(APIViewTestCases.APIViewTestCase): bulk_update_data = { 'status': 'planned', } + bulk_update_invalid_data = { + 'status': 'not-a-valid-status', + } @classmethod def setUpTestData(cls): @@ -511,6 +541,9 @@ class VirtualCircuitTerminationTestCase(APIViewTestCases.APIViewTestCase): bulk_update_data = { 'description': 'New description', } + bulk_update_invalid_data = { + 'role': 'not-a-valid-role', + } @classmethod def setUpTestData(cls):