From 1ec29cfc028d6a18a89783555bc2018d69367a48 Mon Sep 17 00:00:00 2001 From: Jason Novinger Date: Fri, 11 Sep 2026 02:56:55 -0500 Subject: [PATCH] Populate bulk_update_invalid_data for vpn API tests Give each vpn test class an invalid payload so test_bulk_update_objects_validation_error runs instead of skipping. Most vpn models carry several choice fields, so these mostly use one of those. TunnelGroup has none and uses a nonexistent owner pk, matching the organizational models in dcim, and L2VPNTermination uses a nonexistent l2vpn pk because its other relations are read-only. IPSecPolicy uses a non-numeric pfs_group value, since the Diffie-Hellman group choices are integers. All 10 vpn API test classes now run the test. --- netbox/vpn/tests/test_api.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/netbox/vpn/tests/test_api.py b/netbox/vpn/tests/test_api.py index 25695bbf0..dc7e14a77 100644 --- a/netbox/vpn/tests/test_api.py +++ b/netbox/vpn/tests/test_api.py @@ -38,6 +38,9 @@ class TunnelGroupTestCase(APIViewTestCases.APIViewTestCase): bulk_update_data = { 'description': 'New description', } + bulk_update_invalid_data = { + 'owner': 99999, + } @classmethod def setUpTestData(cls): @@ -58,6 +61,9 @@ class TunnelTestCase(APIViewTestCases.APIViewTestCase): 'encapsulation': TunnelEncapsulationChoices.ENCAP_GRE, 'description': 'New description', } + bulk_update_invalid_data = { + 'status': 'not-a-valid-status', + } @classmethod def setUpTestData(cls): @@ -117,6 +123,9 @@ class TunnelTerminationTestCase(APIViewTestCases.APIViewTestCase): bulk_update_data = { 'role': TunnelTerminationRoleChoices.ROLE_PEER, } + bulk_update_invalid_data = { + 'role': 'not-a-valid-role', + } user_permissions = ('vpn.view_tunnel', ) @classmethod @@ -189,6 +198,9 @@ class IKEProposalTestCase(APIViewTestCases.APIViewTestCase): 'group': DHGroupChoices.GROUP_19, 'description': 'New description', } + bulk_update_invalid_data = { + 'authentication_algorithm': 'not-a-valid-authentication-algorithm', + } @classmethod def setUpTestData(cls): @@ -252,6 +264,9 @@ class IKEPolicyTestCase(APIViewTestCases.APIViewTestCase): 'description': 'New description', 'preshared_key': 'New key', } + bulk_update_invalid_data = { + 'version': 'not-a-valid-version', + } @classmethod def setUpTestData(cls): @@ -325,6 +340,9 @@ class IPSecProposalTestCase(APIViewTestCases.APIViewTestCase): 'authentication_algorithm': AuthenticationAlgorithmChoices.AUTH_HMAC_MD5, 'description': 'New description', } + bulk_update_invalid_data = { + 'encryption_algorithm': 'not-a-valid-encryption-algorithm', + } @classmethod def setUpTestData(cls): @@ -374,6 +392,9 @@ class IPSecPolicyTestCase(APIViewTestCases.APIViewTestCase): 'pfs_group': DHGroupChoices.GROUP_5, 'description': 'New description', } + bulk_update_invalid_data = { + 'pfs_group': 'not-a-valid-pfs-group', + } @classmethod def setUpTestData(cls): @@ -519,6 +540,10 @@ class IPSecProfileTestCase(APIViewTestCases.APIViewTestCase): 'description': 'New description', } + cls.bulk_update_invalid_data = { + 'mode': 'not-a-valid-mode', + } + class L2VPNTestCase(APIViewTestCases.APIViewTestCase): model = L2VPN @@ -549,6 +574,9 @@ class L2VPNTestCase(APIViewTestCases.APIViewTestCase): bulk_update_data = { 'description': 'New description', } + bulk_update_invalid_data = { + 'status': 'not-a-valid-status', + } @classmethod def setUpTestData(cls): @@ -656,3 +684,7 @@ class L2VPNTerminationTestCase(APIViewTestCases.APIViewTestCase): cls.bulk_update_data = { 'l2vpn': l2vpns[2].pk } + + cls.bulk_update_invalid_data = { + 'l2vpn': 99999, + }