diff options
author | shangxdy <shang.xiaodong@zte.com.cn> | 2017-02-26 16:22:30 +0800 |
---|---|---|
committer | shangxdy <shang.xiaodong@zte.com.cn> | 2017-02-26 20:23:51 +0800 |
commit | f7b240c6893a48d71da29974e54cb560b6575eb3 (patch) | |
tree | 3d3b8ea171640465cd30bd3d91a88a52cb4487b9 /tosca2heat/heat-translator/translator/tests/test_utils.py | |
parent | 406214e5ca40ad57a1c40e4a8454336f6a26cac2 (diff) |
Sync heat-translator code
Sync heat-translator code from upstream
JIRA:PARSER-119
Change-Id: I2287b78ad38bc54f7740fd1ee5f08989d5e680bf
Signed-off-by: shangxdy <shang.xiaodong@zte.com.cn>
Diffstat (limited to 'tosca2heat/heat-translator/translator/tests/test_utils.py')
-rw-r--r-- | tosca2heat/heat-translator/translator/tests/test_utils.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tosca2heat/heat-translator/translator/tests/test_utils.py b/tosca2heat/heat-translator/translator/tests/test_utils.py index b6d75d9..555555b 100644 --- a/tosca2heat/heat-translator/translator/tests/test_utils.py +++ b/tosca2heat/heat-translator/translator/tests/test_utils.py @@ -234,3 +234,37 @@ class CommonUtilsTest(TestCase): self.assertFalse(self.UrlUtils.validate_url("github.com")) self.assertFalse(self.UrlUtils.validate_url("123")) self.assertFalse(self.UrlUtils.validate_url("a/b/c")) + + def test_get_dict_value(self): + single_snippet = \ + {'nodejs_create_config': + {'type': 'tosca.nodes.SoftwareConfig', + 'properties': + {'config': + {'get_file': 'create.sh'}}}} + actual_output_single_snippet = [] + ex_output_single_snippet = ['create.sh'] + translator.common.utils.get_dict_value(single_snippet, "get_file", + actual_output_single_snippet) + self.assertEqual(actual_output_single_snippet, + ex_output_single_snippet) + multi_snippet = \ + {'resources': + {'nodejs_create_config': + {'type': 'tosca.nodes.SoftwareConfig', + 'properties': + {'config': + {'get_file': 'nodejs/create.sh'}}}, + 'mongodb_create_config': + {'type': 'tosca.nodes.SoftwareConfig', + 'properties': + {'config': + {'get_file': 'mongodb/create.sh'}}}}} + + actual_output_multi_snippet = [] + ex_output_multi_snippet = ['mongodb/create.sh', + 'nodejs/create.sh'] + translator.common.utils.get_dict_value(multi_snippet, "get_file", + actual_output_multi_snippet) + self.assertEqual(sorted(actual_output_multi_snippet), + ex_output_multi_snippet) |