From a212e58d0969433248887bdccd5dab5292b26f87 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Fri, 4 Aug 2017 12:35:37 +0200 Subject: [PATCH] [tempest] also catch BadRequest in negative tests with physical_network in old API Before this field was introduced we would raise BadRequest (HTTP 400), after - NotAcceptable (HTTP 406). Check for any of the exceptions to allow branchless testing. Change-Id: I3fafd4ef7f046a9195fc15f47f7fc967fb959550 --- ironic_tempest_plugin/tests/api/admin/test_ports_negative.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ironic_tempest_plugin/tests/api/admin/test_ports_negative.py b/ironic_tempest_plugin/tests/api/admin/test_ports_negative.py index 492c86c9e8..c25020b258 100644 --- a/ironic_tempest_plugin/tests/api/admin/test_ports_negative.py +++ b/ironic_tempest_plugin/tests/api/admin/test_ports_negative.py @@ -354,7 +354,7 @@ class TestPortsWithPhysicalNetworkOldAPI(base.BaseBaremetalTest): node_id = self.node['uuid'] address = data_utils.rand_mac_address() - self.assertRaises(lib_exc.UnexpectedResponseCode, + self.assertRaises((lib_exc.BadRequest, lib_exc.UnexpectedResponseCode), self.create_port, node_id=node_id, address=address, physical_network='physnet1') @@ -371,7 +371,7 @@ class TestPortsWithPhysicalNetworkOldAPI(base.BaseBaremetalTest): 'op': 'replace', 'value': new_physnet}] - self.assertRaises(lib_exc.UnexpectedResponseCode, + self.assertRaises((lib_exc.BadRequest, lib_exc.UnexpectedResponseCode), self.client.update_port, port['uuid'], patch)