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============================================
38 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
41 from io import StringIO
50 app-name: VNF Validation Tool
52 - name: Environment File Compliance. (Required to Onboard)
53 category: environment_file
55 Checks certain parameters are excluded from the .env file, per HOT Requirements.
56 Required for ASDC onboarding, not needed for manual Openstack testing.
58 polling-freqency: 1000
59 default-verbosity: Standard
63 # noinspection PyShadowingNames
64 @pytest.fixture(scope="module")
66 return vvp.Config(yaml.load(StringIO(DEFAULT_CONFIG)))
69 def test_app_name(config):
70 assert "VNF Validation Tool" in config.app_name
71 assert vvp.VERSION in config.app_name
74 def test_categories_names_length(config):
75 names = config.category_names
76 assert len(names) == 1
77 assert names[0] == "Environment File Compliance. (Required to Onboard)"
80 def test_polling_frequency(config):
81 assert config.polling_frequency == 1000
84 def test_get_category_when_other(config):
86 config.get_category("Environment File Compliance. (Required to Onboard)")
91 def test_default_verbosity(config):
92 assert config.default_verbosity(vvp.ValidatorApp.VERBOSITY_LEVELS) == "Standard (-v)"
95 def test_queues(config):
96 assert config.log_queue.empty(), "Log should start empty"
97 config.log_file.write("Test")
98 assert config.log_queue.get() == "Test"
100 assert config.status_queue.empty(), "status should start empty"
101 config.status_queue.put((True, None))
102 assert config.status_queue.get() == (True, None)
105 MISSING_CATEGORY_FIELD = """
107 app-name: VNF Validation Tool
110 Runs all default validations that apply to all VNF packages
111 regardless of deployment environment
113 polling-freqency: 1000
117 def test_missing_category_fields():
118 settings = yaml.load(StringIO(MISSING_CATEGORY_FIELD))
119 with pytest.raises(RuntimeError) as e:
121 assert "Missing: name" in str(e)
124 def test_default_output_format(config):
125 assert config.default_report_format == "HTML"
128 def test_output_formats(config):
129 for format in ["CSV", "HTML", "Excel"]:
130 assert format in config.report_formats
133 def test_category_names(config):
134 assert "Environment File Compliance. (Required to Onboard)" in config.category_names
137 def test_default_input_format(config):
138 assert "Directory (Uncompressed)" == config.default_input_format
141 def test_input_formats(config):
142 assert "Directory (Uncompressed)" in config.input_formats
143 assert "ZIP File" in config.input_formats