Added remote file digest verification
Change-Id: If91dc29c40e074737baed39805aba43458911952
Issue-ID: VNFSDK-294
Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
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 @@
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')