Fix senlin/sdk client plugin unit tests
New python-openstacksdk has broken the client plugins. This also change to use `status_code` instead of `http_status` of HttpException when checking for bad request. Closes-Bug: #1746956 Change-Id: Ib1f295a6dea014df3237acf0efd6b84464eac9c1
This commit is contained in:
parent
f62167f3de
commit
164a8ab2ba
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user