diff options
author | Ethan Lynn <ethanlynnl@vmware.com> | 2018-04-11 10:33:58 +0800 |
---|---|---|
committer | Ethan Lynn <ethanlynnl@vmware.com> | 2018-04-11 10:33:58 +0800 |
commit | bed78300674d7fc91eeca73fac25ee7ab056346b (patch) | |
tree | 6301f059e0cf7bead50d30fcf57dabb248d5d4ef /vio | |
parent | 6226be7dd524b36d442df3162f6140dffc3b2dcc (diff) |
Add test_post_exist for GetDeleteVolumeView
Add test_post_exist
Change-Id: I3f4856865913802abfae63926a501d386ba22c6c
Issue-ID: MULTICLOUD-199
Signed-off-by: Ethan Lynn <ethanlynnl@vmware.com>
Diffstat (limited to 'vio')
-rw-r--r-- | vio/vio/tests/test_volume_view.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/vio/vio/tests/test_volume_view.py b/vio/vio/tests/test_volume_view.py index b996994..115cb99 100644 --- a/vio/vio/tests/test_volume_view.py +++ b/vio/vio/tests/test_volume_view.py @@ -121,3 +121,29 @@ class TestCreateListVolumeView(unittest.TestCase): ret = self.view.get( mock.Mock(query_params=[]), "vmware_nova", "tenant1") self.assertEqual(500, ret.status_code) + + @mock.patch.object(OperateVolume.OperateVolume, "get_vim_volumes") + @mock.patch.object(OperateVolume.OperateVolume, "get_vim_volume") + @mock.patch.object(extsys, "get_vim_by_id") + def test_post_exist(self, mock_getvim, mock_getvol, mock_getvols): + mock_getvim.return_value = { + "tenant": "tenant-id" + } + vol = mock.Mock() + vol.attachments = [] + vol.id = "vol-id" + vol.name = "vol-name" + vol.created_at = "create time" + vol.status = "ok" + vol.volume_type = "vmdk" + vol.size = 1 + vol.availability_zone = "nova" + mock_getvol.return_value = vol + mock_getvols.return_value = [vol] + req = mock.Mock() + req.body = { + "vol-name" + } + ret = self.view.get( + mock.Mock(query_params=[]), "vmware_nova", "tenant1") + self.assertEqual(200, ret.status_code) |