diff options
author | rabi <ramishra@redhat.com> | 2018-07-17 13:42:07 +0530 |
---|---|---|
committer | ricolin <rico.lin@easystack.cn> | 2018-07-17 16:51:31 +0800 |
commit | b6197161b5228803f247728a2fa6689ed69635ee (patch) | |
tree | 538a2645e01c7ccffa096267744c10b8ba7a1ceb /heat/tests/clients | |
parent | b88f47e5baf0703fb5f178d094540625b414fec5 (diff) | |
download | heat-b6197161b5228803f247728a2fa6689ed69635ee.tar.gz |
Remove unittests monasca until story/2002978 is released
Change-Id: I3399adb0c78fdcac77654560cfafd77eb4e9d009
Story: #2002978
Diffstat (limited to 'heat/tests/clients')
-rw-r--r-- | heat/tests/clients/test_monasca_client.py | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/heat/tests/clients/test_monasca_client.py b/heat/tests/clients/test_monasca_client.py deleted file mode 100644 index adc4cec06..000000000 --- a/heat/tests/clients/test_monasca_client.py +++ /dev/null @@ -1,102 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock -import six - -import monascaclient - -from heat.common import exception as heat_exception -from heat.engine.clients.os import monasca as client_plugin -from heat.tests import common -from heat.tests import utils - - -class MonascaNotificationConstraintTest(common.HeatTestCase): - def test_expected_exceptions(self): - self.assertEqual( - (heat_exception.EntityNotFound,), - client_plugin.MonascaNotificationConstraint.expected_exceptions, - "MonascaNotificationConstraint expected exceptions error") - - def test_constraint(self): - constraint = client_plugin.MonascaNotificationConstraint() - client_mock = mock.MagicMock() - client_plugin_mock = mock.MagicMock() - client_plugin_mock.get_notification.return_value = None - client_mock.client_plugin.return_value = client_plugin_mock - - self.assertIsNone(constraint.validate_with_client(client_mock, - 'notification_1')) - client_plugin_mock.get_notification.assert_called_once_with( - 'notification_1') - - -class MonascaClientPluginTest(common.HeatTestCase): - def test_client(self): - context = utils.dummy_context() - plugin = context.clients.client_plugin('monasca') - client = plugin.client() - self.assertIsNotNone(client.metrics) - - @mock.patch.object(monascaclient.client, '_session') - def test_client_uses_session(self, mock_session): - context = mock.MagicMock() - monasca_client = client_plugin.MonascaClientPlugin(context=context) - self.assertIsNotNone(monasca_client._create()) - - -class MonascaClientPluginNotificationTest(common.HeatTestCase): - - sample_uuid = '477e8273-60a7-4c41-b683-fdb0bc7cd152' - sample_name = 'test-notification' - - def _get_mock_notification(self): - notification = dict() - notification['id'] = self.sample_uuid - notification['name'] = self.sample_name - return notification - - def setUp(self): - super(MonascaClientPluginNotificationTest, self).setUp() - self._client = mock.MagicMock() - self.client_plugin = client_plugin.MonascaClientPlugin( - context=mock.MagicMock() - ) - - @mock.patch.object(client_plugin.MonascaClientPlugin, 'client') - def test_get_notification(self, client_monasca): - mock_notification = self._get_mock_notification() - self._client.notifications.get.return_value = mock_notification - client_monasca.return_value = self._client - - self.assertEqual(self.sample_uuid, - self.client_plugin.get_notification( - self.sample_uuid)) - self._client.notifications.get.assert_called_once_with( - notification_id=self.sample_uuid) - - @mock.patch.object(client_plugin.MonascaClientPlugin, 'client') - def test_get_notification_not_found(self, client_monasca): - self._client.notifications.get.side_effect = ( - client_plugin.monasca_exc.NotFound) - client_monasca.return_value = self._client - - ex = self.assertRaises(heat_exception.EntityNotFound, - self.client_plugin.get_notification, - self.sample_uuid) - msg = ("The Monasca Notification (%(name)s) could not be found." % - {'name': self.sample_uuid}) - self.assertEqual(msg, six.text_type(ex)) - self._client.notifications.get.assert_called_once_with( - notification_id=self.sample_uuid) |