summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEthan Lynn <ethanlynnl@vmware.com>2018-04-11 10:21:58 +0800
committerEthan Lynn <ethanlynnl@vmware.com>2018-04-11 10:23:30 +0800
commit4d68b591fcb1b677f94419b2440b8e03515fa78f (patch)
tree24663c77ff7dbf1f7f677e6b86b7d05dc91b5a67
parent492e09dc39175d8fe77e08cec9818a55274bfac4 (diff)
Add test_delete_fail for volume view
Add test_delete_fail Change-Id: If413b04400480db3a291f707a6ead6418202269d Issue-ID: MULTICLOUD-199 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 780df73..1cb8354 100644
--- a/vio/vio/tests/test_volume_view.py
+++ b/vio/vio/tests/test_volume_view.py
@@ -61,3 +61,13 @@ class TestGetDeleteVolumeView(unittest.TestCase):
mock_delvol.return_value = None
ret = self.view.delete(mock.Mock(), "vmware_nova", "tenant1", "vol-1")
self.assertEqual(204, ret.status_code)
+
+ @mock.patch.object(OperateVolume.OperateVolume, "delete_vim_volume")
+ @mock.patch.object(extsys, "get_vim_by_id")
+ def test_delete_fail(self, mock_getvim, mock_delvol):
+ mock_getvim.return_value = {
+ "tenant": "tenant-id"
+ }
+ mock_delvol.side_effect = [Exception("error")]
+ ret = self.view.delete(mock.Mock(), "vmware_nova", "tenant1", "vol-1")
+ self.assertEqual(500, ret.status_code)