diff options
author | shangxdy <shang.xiaodong@zte.com.cn> | 2016-08-15 15:43:07 +0800 |
---|---|---|
committer | shangxdy <shang.xiaodong@zte.com.cn> | 2016-08-15 15:43:07 +0800 |
commit | f52871b8f5ed66924ae8c715788d0bc09c1518ac (patch) | |
tree | 7661b3950879901ce4245ee67d5dc51dcfb7d524 /tosca2heat/tosca-parser/toscaparser/tests/test_toscatpl.py | |
parent | 5559b0c06930deb1c7831efe599a1036574f50b3 (diff) |
Add required definition in class of Input.
As a template designer;
I want to know if the parameters is missed when deploy a template, but
currently there is not validation about the required parameters;
So i add property in class of Input, and validate the require parameter.
Note: the patch will submit to Openstack community too.
JIRA:PARSER-88
Change-Id: I5763a18da4037b0f81a55b8c8d83414e685b03d2
Signed-off-by: shangxdy <shang.xiaodong@zte.com.cn>
Diffstat (limited to 'tosca2heat/tosca-parser/toscaparser/tests/test_toscatpl.py')
-rw-r--r-- | tosca2heat/tosca-parser/toscaparser/tests/test_toscatpl.py | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/tosca2heat/tosca-parser/toscaparser/tests/test_toscatpl.py b/tosca2heat/tosca-parser/toscaparser/tests/test_toscatpl.py index 2488b65..e229d2f 100644 --- a/tosca2heat/tosca-parser/toscaparser/tests/test_toscatpl.py +++ b/tosca2heat/tosca-parser/toscaparser/tests/test_toscatpl.py @@ -452,7 +452,13 @@ class ToscaTemplateTest(TestCase): tosca_tpl = ('https://raw.githubusercontent.com/openstack/' 'tosca-parser/master/toscaparser/tests/data/' 'tosca_single_instance_wordpress.yaml') - tosca = ToscaTemplate(tosca_tpl, None, False) + tosca = ToscaTemplate(tosca_tpl, a_file=False, + parsed_params={"db_name": "mysql", + "db_user": "mysql", + "db_root_pwd": "1234", + "db_pwd": "5678", + "db_port": 3306, + "cpus": 4}) self.assertTrue(tosca.topology_template.custom_defs) def test_url_template_with_local_abspath_import(self): @@ -473,19 +479,27 @@ class ToscaTemplateTest(TestCase): tosca_tpl = ('https://raw.githubusercontent.com/openstack/' 'tosca-parser/master/toscaparser/tests/data/' 'tosca_single_instance_wordpress_with_url_import.yaml') - tosca = ToscaTemplate(tosca_tpl, None, False) + tosca = ToscaTemplate(tosca_tpl, a_file=False, + parsed_params={"db_root_pwd": "1234"}) self.assertTrue(tosca.topology_template.custom_defs) def test_csar_parsing_wordpress(self): csar_archive = os.path.join( os.path.dirname(os.path.abspath(__file__)), 'data/CSAR/csar_wordpress.zip') - self.assertTrue(ToscaTemplate(csar_archive)) + self.assertTrue(ToscaTemplate(csar_archive, + parsed_params={"db_name": "mysql", + "db_user": "mysql", + "db_root_pwd": "1234", + "db_pwd": "5678", + "db_port": 3306, + "cpus": 4})) def test_csar_parsing_elk_url_based(self): csar_archive = ('https://github.com/openstack/tosca-parser/raw/master/' 'toscaparser/tests/data/CSAR/csar_elk.zip') - self.assertTrue(ToscaTemplate(csar_archive, None, False)) + self.assertTrue(ToscaTemplate(csar_archive, a_file=False, + parsed_params={"my_cpus": 4})) def test_nested_imports_in_templates(self): tosca_tpl = os.path.join( @@ -593,7 +607,7 @@ class ToscaTemplateTest(TestCase): tosca_tpl = os.path.join( os.path.dirname(os.path.abspath(__file__)), "data/CSAR/csar_elk.csar") - tosca = ToscaTemplate(tosca_tpl) + tosca = ToscaTemplate(tosca_tpl, parsed_params={"my_cpus": 2}) self.assertTrue(tosca.topology_template.custom_defs) def test_available_rel_tpls(self): @@ -802,4 +816,4 @@ class ToscaTemplateTest(TestCase): tosca_tpl = os.path.join( os.path.dirname(os.path.abspath(__file__)), "data/test_containers.yaml") - ToscaTemplate(tosca_tpl) + ToscaTemplate(tosca_tpl, parsed_params={"mysql_root_pwd": "12345678"}) |