diff options
author | Lianhao Lu <lianhao.lu@intel.com> | 2018-08-10 17:04:14 +0800 |
---|---|---|
committer | Lianhao Lu <lianhao.lu@intel.com> | 2018-08-15 06:07:53 +0000 |
commit | 9f629ff62c270fd3771c381f78aa36f473e65bb5 (patch) | |
tree | 7feba7a32eaf6f808761502f4c1ab4b949169561 /tests | |
parent | 4e3368b279970e4244addbafbf650b316255d69c (diff) |
Added the logic to validate HPA
Added the code logic to validate HPA for opnfv tosca parser. Also
corrected some hpa validation schema errors introduced by the previous
patch.
Change-Id: Icd61d34d7915aa965ec32adfc3c0f1a117dd6f3e
Issue-ID: VNFSDK-194
Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/resources/hpa.csar | bin | 0 -> 7984 bytes | |||
-rw-r--r-- | tests/resources/hpa_bad.csar | bin | 0 -> 7984 bytes | |||
-rw-r--r-- | tests/validator/test_toscaparser_validator.py | 16 |
3 files changed, 16 insertions, 0 deletions
diff --git a/tests/resources/hpa.csar b/tests/resources/hpa.csar Binary files differnew file mode 100644 index 0000000..a9558ae --- /dev/null +++ b/tests/resources/hpa.csar diff --git a/tests/resources/hpa_bad.csar b/tests/resources/hpa_bad.csar Binary files differnew file mode 100644 index 0000000..4431d61 --- /dev/null +++ b/tests/resources/hpa_bad.csar diff --git a/tests/validator/test_toscaparser_validator.py b/tests/validator/test_toscaparser_validator.py index c35d1ed..3348d60 100644 --- a/tests/validator/test_toscaparser_validator.py +++ b/tests/validator/test_toscaparser_validator.py @@ -15,13 +15,29 @@ import os +import pytest + from vnfsdk_pkgtools.packager import csar from vnfsdk_pkgtools.validator import toscaparser_validator CSAR_PATH = 'tests/resources/test_import.csar' +HPA_PATH = 'tests/resources/hpa.csar' +BAD_HPA_PATH = 'tests/resources/hpa_bad.csar' def test_validate(tmpdir): reader = csar._CSARReader(CSAR_PATH, str(tmpdir.mkdir('validate'))) validator = toscaparser_validator.ToscaparserValidator() validator.validate(reader) assert hasattr(validator, 'tosca') + +def test_validate_hpa(tmpdir): + reader = csar._CSARReader(HPA_PATH, str(tmpdir.mkdir('validate'))) + validator = toscaparser_validator.ToscaparserValidator() + validator.validate(reader) + assert hasattr(validator, 'tosca') + +def test_validate_hpa_bad(tmpdir): + reader = csar._CSARReader(BAD_HPA_PATH, str(tmpdir.mkdir('validate'))) + validator = toscaparser_validator.ToscaparserValidator() + with pytest.raises(toscaparser_validator.HpaValueError): + validator.validate(reader) |