2 # ============LICENSE_START====================================================
3 # org.onap.vvp/validation-scripts
4 # ===================================================================
5 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 # ===================================================================
8 # Unless otherwise specified, all software contained herein is licensed
9 # under the Apache License, Version 2.0 (the "License");
10 # you may not use this software except in compliance with the License.
11 # You may obtain a copy of the License at
13 # http://www.apache.org/licenses/LICENSE-2.0
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
23 # Unless otherwise specified, all documentation contained herein is licensed
24 # under the Creative Commons License, Attribution 4.0 Intl. (the "License");
25 # you may not use this documentation except in compliance with the License.
26 # You may obtain a copy of the License at
28 # https://creativecommons.org/licenses/by/4.0/
30 # Unless required by applicable law or agreed to in writing, documentation
31 # distributed under the License is distributed on an "AS IS" BASIS,
32 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33 # See the License for the specific language governing permissions and
34 # limitations under the License.
36 # ============LICENSE_END============================================
40 from io import StringIO
49 app-name: VNF Validation Tool
51 - name: Environment File Compliance. (Required to Onboard)
52 category: environment_file
54 Checks certain parameters are excluded from the .env file, per HOT Requirements.
55 Required for ASDC onboarding, not needed for manual Openstack testing.
57 polling-freqency: 1000
58 default-verbosity: Standard
62 # noinspection PyShadowingNames
63 @pytest.fixture(scope="module")
65 return vvp.Config(yaml.safe_load(StringIO(DEFAULT_CONFIG)))
68 def test_app_name(config):
69 assert "VNF Validation Tool" in config.app_name
70 assert vvp.VERSION in config.app_name
73 def test_categories_names_length(config):
74 names = config.category_names
75 assert len(names) == 1
76 assert names[0] == "Environment File Compliance. (Required to Onboard)"
79 def test_polling_frequency(config):
80 assert config.polling_frequency == 1000
83 def test_get_category_when_other(config):
85 config.get_category("Environment File Compliance. (Required to Onboard)")
90 def test_default_verbosity(config):
91 assert config.default_verbosity(vvp.ValidatorApp.VERBOSITY_LEVELS) == "Standard (-v)"
94 def test_queues(config):
95 assert config.log_queue.empty(), "Log should start empty"
96 config.log_file.write("Test")
97 assert config.log_queue.get() == "Test"
99 assert config.status_queue.empty(), "status should start empty"
100 config.status_queue.put((True, None))
101 assert config.status_queue.get() == (True, None)
104 MISSING_CATEGORY_FIELD = """
106 app-name: VNF Validation Tool
109 Runs all default validations that apply to all VNF packages
110 regardless of deployment environment
112 polling-freqency: 1000
116 def test_missing_category_fields():
117 settings = yaml.safe_load(StringIO(MISSING_CATEGORY_FIELD))
118 with pytest.raises(RuntimeError) as e:
120 assert "Missing: name" in str(e)
123 def test_default_output_format(config):
124 assert config.default_report_format == "HTML"
127 def test_output_formats(config):
128 for format in ["CSV", "HTML", "Excel"]:
129 assert format in config.report_formats
132 def test_category_names(config):
133 assert "Environment File Compliance. (Required to Onboard)" in config.category_names
136 def test_default_input_format(config):
137 assert "Directory (Uncompressed)" == config.default_input_format
140 def test_input_formats(config):
141 assert "Directory (Uncompressed)" in config.input_formats
142 assert "ZIP File" in config.input_formats