diff --git a/heat/engine/clients/os/senlin.py b/heat/engine/clients/os/senlin.py index bfad6b39f9..c88b795d1e 100644 --- a/heat/engine/clients/os/senlin.py +++ b/heat/engine/clients/os/senlin.py @@ -69,7 +69,7 @@ class SenlinClientPlugin(client_plugin.ClientPlugin): def is_bad_request(self, ex): return (isinstance(ex, exc.sdkexc.HttpException) and - ex.http_status == 400) + ex.status_code == 400) def execute_actions(self, actions): all_executed = True diff --git a/heat/tests/clients/test_sdk_client.py b/heat/tests/clients/test_sdk_client.py index e4e3f4d652..45935b13ca 100644 --- a/heat/tests/clients/test_sdk_client.py +++ b/heat/tests/clients/test_sdk_client.py @@ -22,7 +22,8 @@ from heat.tests import utils class OpenStackSDKPluginTest(common.HeatTestCase): - def test_create(self): + @mock.patch('openstack.connection.Connection') + def test_create(self, mock_connection): context = utils.dummy_context() plugin = context.clients.client_plugin('openstack') client = plugin.client() diff --git a/heat/tests/clients/test_senlin_client.py b/heat/tests/clients/test_senlin_client.py index 3434444c43..7bad95aba2 100644 --- a/heat/tests/clients/test_senlin_client.py +++ b/heat/tests/clients/test_senlin_client.py @@ -12,15 +12,16 @@ # under the License. import mock +from senlinclient.common import exc from heat.engine.clients.os import senlin as senlin_plugin from heat.tests import common from heat.tests import utils -from senlinclient.common import exc class SenlinClientPluginTest(common.HeatTestCase): - def setUp(self): + @mock.patch('openstack.connection.Connection') + def setUp(self, mock_connection): super(SenlinClientPluginTest, self).setUp() context = utils.dummy_context() self.plugin = context.clients.client_plugin('senlin') @@ -71,7 +72,8 @@ class SenlinClientPluginTest(common.HeatTestCase): class ProfileConstraintTest(common.HeatTestCase): - def setUp(self): + @mock.patch('openstack.connection.Connection') + def setUp(self, mock_connection): super(ProfileConstraintTest, self).setUp() self.senlin_client = mock.MagicMock() self.ctx = utils.dummy_context() @@ -95,7 +97,8 @@ class ProfileConstraintTest(common.HeatTestCase): class ClusterConstraintTest(common.HeatTestCase): - def setUp(self): + @mock.patch('openstack.connection.Connection') + def setUp(self, mock_connection): super(ClusterConstraintTest, self).setUp() self.senlin_client = mock.MagicMock() self.ctx = utils.dummy_context() @@ -119,7 +122,8 @@ class ClusterConstraintTest(common.HeatTestCase): class PolicyConstraintTest(common.HeatTestCase): - def setUp(self): + @mock.patch('openstack.connection.Connection') + def setUp(self, mock_connection): super(PolicyConstraintTest, self).setUp() self.senlin_client = mock.MagicMock() self.ctx = utils.dummy_context() @@ -143,7 +147,8 @@ class PolicyConstraintTest(common.HeatTestCase): class ProfileTypeConstraintTest(common.HeatTestCase): - def setUp(self): + @mock.patch('openstack.connection.Connection') + def setUp(self, mock_connection): super(ProfileTypeConstraintTest, self).setUp() self.senlin_client = mock.MagicMock() self.ctx = utils.dummy_context() @@ -168,7 +173,8 @@ class ProfileTypeConstraintTest(common.HeatTestCase): class PolicyTypeConstraintTest(common.HeatTestCase): - def setUp(self): + @mock.patch('openstack.connection.Connection') + def setUp(self, mock_connection): super(PolicyTypeConstraintTest, self).setUp() self.senlin_client = mock.MagicMock() self.ctx = utils.dummy_context()