diff options
author | 2018-03-27 15:23:50 -0700 | |
---|---|---|
committer | 2018-03-27 15:23:50 -0700 | |
commit | c5efd2e3e99d11c6fa80a9f05ac94091a56b11ba (patch) | |
tree | 1981c6dbedb40835361c98c91ae4683fe28883ea /vio | |
parent | b5c12fa218572e79a62394b3fd9f6620aa409da1 (diff) |
Add test_get for ListImageView
Add test_get
Change-Id: Ib2684404b7510fcfa0b0e9ad79fe683fa332707c
Issue-ID: MULTICLOUD-199
Signed-off-by: Ethan Lynn <ethanlynnl@vmware.com>
Diffstat (limited to 'vio')
-rw-r--r-- | vio/vio/tests/test_image_view.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/vio/vio/tests/test_image_view.py b/vio/vio/tests/test_image_view.py index 989eb33..968826f 100644 --- a/vio/vio/tests/test_image_view.py +++ b/vio/vio/tests/test_image_view.py @@ -48,3 +48,24 @@ class TestGetDeleteImageView(unittest.TestCase): mock.Mock(), "vmware_nova", "tenant1", "image1") self.assertEqual(204, resp.status_code) mock_delimg.assert_called_once() + + +class TestCreateListImagesView(unittest.TestCase): + + def setUp(self): + self.view = views.CreateListImagesView() + + @mock.patch.object(OperateImage.OperateImage, "get_vim_images") + @mock.patch.object(extsys, "get_vim_by_id") + def test_get(self, mock_getvim, mock_getimgs): + mock_getvim.return_value = { + "tenant": "tenant-id" + } + img = mock.Mock() + img.to_dict.return_value = { + "id": "image-id" + } + mock_getimgs.return_value = [img] + resp = self.view.get( + mock.Mock(query_params=[]), "vmware_nova", "tenant1") + self.assertEqual(200, resp.status_code) |