From 920344c276c466ec1a6b8d1c2bbd56f9c71e53d1 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 16 Feb 2024 18:09:39 +0900 Subject: [PATCH] Drop unused parameter type validation method ... according to the TODO note added almost 5 years ago[1]. The method is not used even now. [1] fb14f24cc38a546f96adfc0446879716ca4c883e Change-Id: I2367680ca0f39cdfb5e0600ea67de254e744f4c3 Signed-off-by: Takashi Kajinami --- nova/api/validation/parameter_types.py | 9 --------- nova/tests/unit/test_api_validation.py | 25 ------------------------- 2 files changed, 34 deletions(-) diff --git a/nova/api/validation/parameter_types.py b/nova/api/validation/parameter_types.py index 2bb58696ee6c..29253aa58324 100644 --- a/nova/api/validation/parameter_types.py +++ b/nova/api/validation/parameter_types.py @@ -341,15 +341,6 @@ description = { 'maxLength': 255, } -# TODO(stephenfin): This is no longer used and should be removed -tcp_udp_port = { - 'type': ['integer', 'string'], - 'pattern': '^[0-9]*$', - 'minimum': 0, - 'maximum': 65535, - 'minLength': 1, -} - project_id = { 'type': 'string', 'pattern': '^[a-zA-Z0-9-]*$', diff --git a/nova/tests/unit/test_api_validation.py b/nova/tests/unit/test_api_validation.py index 357e9bb5e2aa..badd4b1fddb7 100644 --- a/nova/tests/unit/test_api_validation.py +++ b/nova/tests/unit/test_api_validation.py @@ -764,31 +764,6 @@ class NameOrNoneTestCase(APIValidationTestCase): expected_detail=detail) -class TcpUdpPortTestCase(APIValidationTestCase): - - post_schema = { - 'type': 'object', - 'properties': { - 'foo': parameter_types.tcp_udp_port, - }, - } - - def test_validate_tcp_udp_port(self): - self.post(body={'foo': 1024}, req=FakeRequest()) - self.post(body={'foo': '1024'}, req=FakeRequest()) - - def test_validate_tcp_udp_port_fails(self): - detail = ("Invalid input for field/attribute foo. Value: True." - " True is not of type 'integer', 'string'") - self.check_validation_error(self.post, body={'foo': True}, - expected_detail=detail) - - detail = ("Invalid input for field/attribute foo. Value: 65536." - " 65536 is greater than the maximum of 65535") - self.check_validation_error(self.post, body={'foo': 65536}, - expected_detail=detail) - - class CidrFormatTestCase(APIValidationTestCase): post_schema = {