From af33d8bd71d5974cc3d2ddad83e32b9e2097257c Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Fri, 7 Jun 2024 10:28:30 -0700 Subject: [PATCH] minor: additional tests for interaction around node lookup A recent evaluation of the lookup code yielded an awareness that while we're sort of following the overall community pattern of testing what we expect in terms of patterns and behavior, really needed just a little bit more in the way of testing. While ultimately, these tests are really just exercising front end validation, it is still important to check to have increased assurance of a secure codebase. Change-Id: Iaa917191e0f118f8828161174ea1fe8c55c8f4ee --- .../tests/unit/api/controllers/v1/test_ramdisk.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ironic/tests/unit/api/controllers/v1/test_ramdisk.py b/ironic/tests/unit/api/controllers/v1/test_ramdisk.py index 0eb4fe426f..2ba4c8b1b5 100644 --- a/ironic/tests/unit/api/controllers/v1/test_ramdisk.py +++ b/ironic/tests/unit/api/controllers/v1/test_ramdisk.py @@ -94,6 +94,20 @@ class TestLookup(test_api_base.BaseApiTest): expect_errors=True) self.assertEqual(http_client.BAD_REQUEST, response.status_int) + def test_invalid_input_addresses(self): + response = self.get_json( + '/lookup?addresses=meow1', + headers={api_base.Version.string: str(api_v1.max_version())}, + expect_errors=True) + self.assertEqual(http_client.BAD_REQUEST, response.status_int) + + def test_invalid_input_node_uuid(self): + response = self.get_json( + '/lookup?node_uuid=meow1', + headers={api_base.Version.string: str(api_v1.max_version())}, + expect_errors=True) + self.assertEqual(http_client.BAD_REQUEST, response.status_int) + def test_not_found(self): response = self.get_json( '/lookup?addresses=%s' % ','.join(self.addresses),