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
diff --git a/ironic_tempest_plugin/tests/api/admin/test_deploy_templates.py b/ironic_tempest_plugin/tests/api/admin/test_deploy_templates.py
index 2de93e8..0092a06 100644
--- a/ironic_tempest_plugin/tests/api/admin/test_deploy_templates.py
+++ b/ironic_tempest_plugin/tests/api/admin/test_deploy_templates.py
@@ -202,7 +202,8 @@
@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 @@
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())