summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEthan Lynn <ethanlynnl@vmware.com>2018-04-11 10:16:11 +0800
committerEthan Lynn <ethanlynnl@vmware.com>2018-04-11 10:18:53 +0800
commit094b5c18bb8724acbd8092402baed2ac09f9b376 (patch)
tree9c644fb1bf4b9a2f944c619dc2cc53bf88946b3b
parent962bcb07625220a2d5cf0728db8114974c820339 (diff)
Add test_get_fail for volume view
Add test_get_fail for volume view Issue-ID: MULTICLOUD-199 Change-Id: Ib40d97240c56ac71489588bf88e9f7dff8c5a183 Signed-off-by: Ethan Lynn <ethanlynnl@vmware.com>
-rw-r--r--vio/vio/tests/test_volume_view.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/vio/vio/tests/test_volume_view.py b/vio/vio/tests/test_volume_view.py
index 90f4bda..6e02287 100644
--- a/vio/vio/tests/test_volume_view.py
+++ b/vio/vio/tests/test_volume_view.py
@@ -41,3 +41,13 @@ class TestGetDeleteVolumeView(unittest.TestCase):
mock_getvol.return_value = vol
ret = self.view.get(mock.Mock(), "vmware_nova", "tenant1", "vol-1")
self.assertEqual(200, ret.status_code)
+
+ @mock.patch.object(OperateVolume.OperateVolume, "get_vim_volume")
+ @mock.patch.object(extsys, "get_vim_by_id")
+ def test_get_fail(self, mock_getvim, mock_getvol):
+ mock_getvim.return_value = {
+ "tenant": "tenant-id"
+ }
+ mock_getvol.side_effect = [Exception("error here")]
+ ret = self.view.get(mock.Mock(), "vmware_nova", "tenant1", "vol-1")
+ self.assertEqual(500, ret.status_code)