Test manila and zaqar exceptions

Change-Id: Id171030db4ede009885b9f330edd4c61f38529fe
Closes-Bug: #1461967
This commit is contained in:
Tetiana Lashchova 2015-06-09 18:33:13 +03:00
parent b0995e89f2
commit 13db9ccfee
2 changed files with 44 additions and 0 deletions

View File

@ -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

View File

@ -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):