Check unicode for string 90/86990/1
authorYang Xu <yang.xu3@huawei.com>
Mon, 6 May 2019 02:59:57 +0000 (22:59 -0400)
committerYang Xu <yang.xu3@huawei.com>
Mon, 6 May 2019 03:02:35 +0000 (23:02 -0400)
Change-Id: I2d647a82fa38b1ef9ee5b8a2d80296f069e2f079
Issue-ID: INT-1064
Signed-off-by: Yang Xu <yang.xu3@huawei.com>
robotframework-onap/eteutils/HEATUtils.py
robotframework-onap/eteutils/JSONUtils.py

index 93d556a..69c026e 100644 (file)
@@ -12,7 +12,7 @@ class HEATUtils:
 
     def get_yaml(self, template_file):
         """Template Yaml To Json reads a YAML Heat template file returns a JSON string that can be used included in an Openstack Add Stack Request"""
-        if isinstance(template_file, str):
+        if isinstance(template_file, str) or isinstance(template_file, unicode):
             fin = open(template_file, 'r')
             yamlobj = yaml.load(fin)
             return yamlobj
@@ -20,7 +20,8 @@ class HEATUtils:
 
     def template_yaml_to_json(self, template_file):
         """Template Yaml To Json reads a YAML Heat template file returns a JSON string that can be used included in an Openstack Add Stack Request"""
-        if isinstance(template_file, str):
+        contents = None
+        if isinstance(template_file, str) or isinstance(template_file, unicode):
             fin = open(template_file, 'r')
             yamlobj = yaml.load(fin)
             fin.close()
@@ -35,7 +36,7 @@ class HEATUtils:
 
     def env_yaml_to_json(self, template_file):
         """Env Yaml To JSon reads a YAML Heat env file and returns a JSON string that can be used included in an Openstack Add Stack Request"""
-        if isinstance(template_file, str):
+        if isinstance(template_file, str) or isinstance(template_file, unicode):
             fin = open(template_file, 'r')
             yamlobj = yaml.load(fin)
             fin.close()
index e5de182..2d0868c 100644 (file)
@@ -7,11 +7,11 @@ class JSONUtils:
     
     def json_equals(self, left, right):
         """JSON Equals takes in two strings or json objects, converts them into json if needed and then compares them, returning if they are equal or not."""
-        if isinstance(left, str):
+        if isinstance(left, str) or isinstance(left, unicode):
             left_json = json.loads(left);
         else:
             left_json = left;
-        if isinstance(right, str):
+        if isinstance(right, str) or isinstance(right, unicode):
             right_json = json.loads(right);
         else:
             right_json = right;