diff options
author | Lianhao Lu <lianhao.lu@intel.com> | 2018-08-30 10:24:40 +0800 |
---|---|---|
committer | Lianhao Lu <lianhao.lu@intel.com> | 2018-08-30 10:46:35 +0800 |
commit | 40bcf5a05ba8d1aaa933e7fa5f7880793555e07b (patch) | |
tree | 0a41c05ffc0dea9c2d128c63ef7c51c3fed7b599 /tests | |
parent | 0af4624891b9de8bd455acd584ea3fa4a87304b8 (diff) |
Test for vnf requirement R-77707
Implement test for vnf requirement R-77707: provider MUST include a
Manifest File that contains a list of all the components in the VNF
package.
Change-Id: Ief3f8af2cce20d003007147f106ba9c72bcde292
Issue-ID: VNFSDK-317
Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/vnfreq/test_pkg_reqs.py | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/tests/vnfreq/test_pkg_reqs.py b/tests/vnfreq/test_pkg_reqs.py index b712212..b83a860 100644 --- a/tests/vnfreq/test_pkg_reqs.py +++ b/tests/vnfreq/test_pkg_reqs.py @@ -17,11 +17,36 @@ import pytest from vnfsdk_pkgtools import vnfreq -def test_R66070_fail(mocker): + +def check_result(reqid, reader, tosca, expected_fail_msg): + tester = vnfreq.get_vnfreq_tester(reqid) + tester.check(reader, tosca) + if expected_fail_msg: + assert isinstance(tester.err, vnfreq.VnfRequirementError) + assert expected_fail_msg in str(tester.err) + else: + assert tester.err == 0 + + +def test_R66070(mocker): reader = mocker.Mock() reader.manifest = None + check_result('R-66070', reader, None, 'No manifest file found') + + +def test_R77707(mocker, tmpdir): + # check only manifest file - success + p1 = tmpdir.join("manifest.mf") + p1.write("manifest") + reader = mocker.Mock() + reader.destination = str(tmpdir) + reader.entry_manifest_file = "manifest.mf" + reader.manifest.digests = {} + check_result('R-77707', reader, None, None) - tester = vnfreq.get_vnfreq_tester("R-66070") - tester.check(reader, None) - assert isinstance(tester.err, vnfreq.VnfRequirementError) + # check additional file - fail + p2 = tmpdir.mkdir('sub').join("non-existing") + p2.write("non existing") + check_result('R-77707', reader, None, + 'Package component sub/non-existing not found in manifest file') |