summaryrefslogtreecommitdiffstats
path: root/tests/fetchimg_test.py
diff options
context:
space:
mode:
authorwu.zhihui <wu.zhihui1@zte.com.cn>2016-09-23 16:53:55 +0800
committerwu.zhihui <wu.zhihui1@zte.com.cn>2016-09-27 11:20:11 +0800
commit1a2b55736da4d18758f81444933181e380202f60 (patch)
treeb6c0dec37b7989456feb82485aed629333e9af36 /tests/fetchimg_test.py
parent58ac79cd54821bf8c3891d136be4254aa79bfa08 (diff)
code refactor: run_qtip.sh
1. Add prepare_qtip_image.sh to prepare qtip image before qtip test. 2. Add cleanup_qtip_image.sh to clean up qtip image after finishing qtip test. Both of them are invoked in run_qtip.sh Change-Id: Iba892a2e02e31820ed0525f80a4e2885899557e0 Signed-off-by: wu.zhihui <wu.zhihui1@zte.com.cn>
Diffstat (limited to 'tests/fetchimg_test.py')
-rw-r--r--tests/fetchimg_test.py34
1 files changed, 0 insertions, 34 deletions
diff --git a/tests/fetchimg_test.py b/tests/fetchimg_test.py
deleted file mode 100644
index 5d482567..00000000
--- a/tests/fetchimg_test.py
+++ /dev/null
@@ -1,34 +0,0 @@
-import mock
-from func.fetchimg import FetchImg
-
-
-class TestClass:
- @mock.patch('func.fetchimg.os')
- @mock.patch('func.fetchimg.os.path')
- def test_fetch_img_success(self, mock_path, mock_os):
- mock_os.system.return_value = True
- mock_path.isfile.return_value = True
- img = FetchImg()
- img.download()
-
- @mock.patch('func.fetchimg.time')
- @mock.patch('func.fetchimg.os.system')
- @mock.patch('func.fetchimg.os.path')
- def test_fetch_img_fail(self, mock_path, mock_system, mock_time):
- img = FetchImg()
- mock_system.return_value = True
- mock_path.isfile.side_effect = [False, False, True]
- img.download()
- assert mock_time.sleep.call_count == 2
-
- @mock.patch('func.fetchimg.time')
- @mock.patch('func.fetchimg.os.system')
- @mock.patch('func.fetchimg.os.path')
- def test_fetch_temp_success(self, mock_path, mock_system, mock_time):
- img = FetchImg()
- mock_system.return_value = True
- mock_path.isfile.side_effect = [True]
- img.download()
- filepath = './Temp_Img/QTIP_CentOS.qcow2'
- imgstorepath = "/home/opnfv/imgstore/QTIP_CentOS.qcow2"
- mock_system.assert_called_with("ln -s %s %s" % (imgstorepath, filepath))