aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLianhao Lu <lianhao.lu@intel.com>2018-07-26 17:50:28 +0800
committerLianhao Lu <lianhao.lu@intel.com>2018-07-26 17:50:28 +0800
commit979471fd238cba6847c7e16400c3d8fdb4cc9711 (patch)
treee78d36b85346c03575fdc9ded6857efdb12f99af /tests
parentf570936d2f1be946c0fa3a7f7d23c92310a6e2a9 (diff)
Added remote file digest verification
Change-Id: If91dc29c40e074737baed39805aba43458911952 Issue-ID: VNFSDK-294 Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/packager/test_utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/packager/test_utils.py b/tests/packager/test_utils.py
index 03b3f24..91fc72b 100644
--- a/tests/packager/test_utils.py
+++ b/tests/packager/test_utils.py
@@ -26,3 +26,11 @@ def test_cal_file_hash(tmpdir):
p.write(CONTENT)
assert SHA512 == utils.cal_file_hash("", str(p), 'SHA512')
assert SHA256 == utils.cal_file_hash(p.dirname, p.basename, 'sha256')
+
+def test_cal_file_hash_remote(mocker):
+ class FakeRequest(object):
+ def __init__(self, *args):
+ self.status_code = 200
+ self.content = CONTENT
+ mocker.patch('requests.get', new=FakeRequest)
+ assert SHA256 == utils.cal_file_hash("", "http://fake", 'sha256')