From 13db9ccfee2c52f20171b11711fa1079b81118db Mon Sep 17 00:00:00 2001 From: Tetiana Lashchova Date: Tue, 9 Jun 2015 18:33:13 +0300 Subject: [PATCH] Test manila and zaqar exceptions Change-Id: Id171030db4ede009885b9f330edd4c61f38529fe Closes-Bug: #1461967 --- heat/engine/clients/os/manila.py | 2 ++ heat/tests/test_clients.py | 42 ++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/heat/engine/clients/os/manila.py b/heat/engine/clients/os/manila.py index 8076a8b825..83b44f99e9 100644 --- a/heat/engine/clients/os/manila.py +++ b/heat/engine/clients/os/manila.py @@ -20,6 +20,8 @@ MANILACLIENT_VERSION = "1" class ManilaClientPlugin(client_plugin.ClientPlugin): + exceptions_module = exceptions + @staticmethod def is_available(): return manila_client is not None diff --git a/heat/tests/test_clients.py b/heat/tests/test_clients.py index 98d0432e98..3c90ae1f7b 100644 --- a/heat/tests/test_clients.py +++ b/heat/tests/test_clients.py @@ -19,6 +19,7 @@ from heatclient import client as heatclient from heatclient import exc as heat_exc from keystoneclient.auth.identity import v3 from keystoneclient import exceptions as keystone_exc +from manilaclient import exceptions as manila_exc import mock from neutronclient.common import exceptions as neutron_exc from oslo_config import cfg @@ -27,6 +28,7 @@ import six from swiftclient import exceptions as swift_exc from testtools import testcase from troveclient import client as troveclient +from zaqarclient.transport import errors as zaqar_exc from heat.common import context from heat.common import exception @@ -664,6 +666,46 @@ class TestIsNotFound(common.HeatTestCase): exception=lambda: sahara_base.APIException( error_message='conflict1', error_code=409), )), + ('zaqar_not_found', dict( + is_not_found=True, + is_over_limit=False, + is_client_exception=True, + is_conflict=False, + plugin='zaqar', + exception=lambda: zaqar_exc.ResourceNotFound(), + )), + ('manila_not_found', dict( + is_not_found=True, + is_over_limit=False, + is_client_exception=True, + is_conflict=False, + plugin='manila', + exception=lambda: manila_exc.NotFound(), + )), + ('manila_exception', dict( + is_not_found=False, + is_over_limit=False, + is_client_exception=False, + is_conflict=False, + plugin='manila', + exception=lambda: Exception() + )), + ('manila_overlimit', dict( + is_not_found=False, + is_over_limit=True, + is_client_exception=True, + is_conflict=False, + plugin='manila', + exception=lambda: manila_exc.RequestEntityTooLarge(), + )), + ('manila_conflict', dict( + is_not_found=False, + is_over_limit=False, + is_client_exception=True, + is_conflict=True, + plugin='manila', + exception=lambda: manila_exc.Conflict(), + )), ] def test_is_not_found(self):