diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | data/hosts | 4 | ||||
-rw-r--r-- | data/my_key.pem | 27 | ||||
-rw-r--r-- | tests/fetchimg_test.py | 14 |
4 files changed, 15 insertions, 32 deletions
@@ -45,6 +45,8 @@ nosetests.xml coverage.xml *,cover .hypothesis/ +data/hosts +data/my_key.pem # Translations *.mo diff --git a/data/hosts b/data/hosts deleted file mode 100644 index 1d3f32d8..00000000 --- a/data/hosts +++ /dev/null @@ -1,4 +0,0 @@ -[2-host] -172.18.1.65 -[1-server] -172.18.1.66 diff --git a/data/my_key.pem b/data/my_key.pem deleted file mode 100644 index b47325a5..00000000 --- a/data/my_key.pem +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpQIBAAKCAQEArKdjCi8b5pez+UO/hdpdaTKJA4AYDXB5kK51QKgxKRiVzlbX -72Cyg0U9HaVF1LM/lkqT6KNY+GT2HtchO40pR2AVsedkAQgShm+rx0wj7bEO8qAE -nm/IIowYO5m01mt6VKUCDiY/KNzDus1+24sSj/FnynMMhI/x9A8LG4/9P+dRNRUh -qtqcYeKWaWDhOgpOmOmlflLocMPby0jmvMOz0/4M/ULk2qn2j2geI0NpG4DiUTrG -lj2BSmBe7X+O7ppXCS6Q2+mLp0yncOU+LFcFrvS2hiIVWuy2Hl4/9qBtp/BtcPLm -88b9/XCVzQ9cYQMqCLGmzzsZjsnr4fuMlWyu4wIDAQABAoIBAQCXkVarsRGATHst -fyEaY8mPOVL45LG40p2VuuGqQjzuA+w3ORvVxIDSJq1xYg68nCNdT9kq6IOJhDBg -gKFnAxRS2XISPL0Y/roslMorapc76iziKEIFyMHcOjpn0BbmCXJZ7oWwYDkgKTYW -vqH4H83K2bUxD/DUSv2wMKiiqLQ9LOYSwAUS0A/bQ8jVcmxXvtkqMofNesv3OEVJ -5yrnbhNfXJCIfVsn2NtM/q3boY3j7SNUellyL/XXy6BVXYU/aCN28uosjkXlADW7 -Dwphdu5iEY0eA94YQaRIFVwFerrPXIEmBMAoZd0/57Ai2tYa2B1MQgHNelkAOHb/ -9mzqR/mpAoGBANz6tsmGIbX/WiNUcixHt7T8f4+2Rb+cDI7yI+VM4/E9ba8J/Fi9 -3JjVZUfaUN2NxOf1f1oVBw/UNlCpGQ9Tiuaq6EvOHP26dqdr5EDDjbW0m6/q6Sd1 -gK6sTX2l3aEcQrUPpuuMLgo4jkiEuI7mQSqNt51Z5qHSJRLRp6ri+GedAoGBAMgE -Euf+93VoV2M46A9d1oXVDO6qL/U/FCTJmr0tW1X5tMmgXKHiM15Zp5bfPYzQsSoL -7x6v+M+26uJHPWmSTmJDOBe7gFbcIIzacJficSqGhR3Dm3GBqaUgw3tl7KfBeR1T -hpLovRthcJChLij174fB2nUtUQ6jhziqml5dB+h/AoGAWv35yl2q//AXw7iAEu+t -G59lP14EtnOhUDMwyLiym6F5yrvH5xq2/U/Rlpa0+aXo0MLsH8HM2J2/h9M5eHAk -H/t8D8rdcTUYqrPolypu7cVi3jtSqmbeCA73Eaf87NxgM4Iwb4mXY6oKHJ5aCK2T -Y9xbITXlm/iWP3uJGPrA4pkCgYEAimynWP/P6uVndTfxApGC4eRsqtAFmMkq+7q6 -6Kn3SC0kvVXKRg7yVh3eKkAdrNLRibPwrWBD5h1FuYxsKCAlN0QmEeamD3cQ3+pd -egAxKaknf03cylVePvXJ1CDaA8+WLoGb5RhFqClraezisV5jg6TZt7bBHkx2TPVl -GGFyE6kCgYEAnYNXrBfmyJDb737e8Aca3fEGXhJHNUKbTMp62CGj2oe1AzDly4ab -k2c4ID9IukmjljZ2G911BdSa2D9V7Aj5D02g5bmvi5e4zjZYiwxK4j5Gd4zEje4w -G4l3ndezp6O6KfMvEqGdC7njK31yUy7991lqqpg4skYfhryPyUAH/TY= ------END RSA PRIVATE KEY----- diff --git a/tests/fetchimg_test.py b/tests/fetchimg_test.py index 683c9701..5d482567 100644 --- a/tests/fetchimg_test.py +++ b/tests/fetchimg_test.py @@ -17,6 +17,18 @@ class TestClass: 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, 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)) |