Deploy Templates: Allow old ironic API to return 405

Previous ironic releases without deploy templates support return 405 for
non-GET methods to unsupported endpoints. GET returns 404. In versions
of ironic with API 1.55 support, 404 is returned in all cases.

Change-Id: I501bdcf8a20d9ca14d9ec6adbafda34c35b43a5f
Story: 1722275
Task: 29984
This commit is contained in:
Mark Goddard 2019-03-12 14:06:31 +00:00
parent a78c676cdd
commit fb8c51e4f7
1 changed files with 6 additions and 3 deletions

View File

@ -202,7 +202,8 @@ class TestDeployTemplatesOldAPI(base.BaseBaremetalTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('e9481a0d-23e0-4757-bc11-c3c9ab9d3839')
def test_create_deploy_template_old_api(self):
self.assertRaises(lib_exc.NotFound,
# With deploy templates support, ironic returns 404. Without, 405.
self.assertRaises((lib_exc.NotFound, lib_exc.UnexpectedResponseCode),
self.create_deploy_template,
name=_get_random_trait(), steps=EXAMPLE_STEPS)
@ -212,14 +213,16 @@ class TestDeployTemplatesOldAPI(base.BaseBaremetalTest):
patch = [{'path': '/name', 'op': 'replace',
'value': _get_random_trait()}]
self.assertRaises(lib_exc.NotFound,
# With deploy templates support, ironic returns 404. Without, 405.
self.assertRaises((lib_exc.NotFound, lib_exc.UnexpectedResponseCode),
self.client.update_deploy_template,
_get_random_trait(), patch)
@decorators.attr(type=['negative'])
@decorators.idempotent_id('1646b1e5-ab81-45a8-9ea0-30444a4dcaa2')
def test_delete_deploy_template_old_api(self):
self.assertRaises(lib_exc.NotFound,
# With deploy templates support, ironic returns 404. Without, 405.
self.assertRaises((lib_exc.NotFound, lib_exc.UnexpectedResponseCode),
self.client.delete_deploy_template,
_get_random_trait())