add string templating to new way 46/90246/1
authorDR695H <dr695h@att.com>
Thu, 20 Jun 2019 19:34:53 +0000 (15:34 -0400)
committerDR695H <dr695h@att.com>
Thu, 20 Jun 2019 19:35:15 +0000 (15:35 -0400)
Change-Id: Ic32be25a808a90948b77ce43c5fe4e5f1f59a1dd
Issue-ID: TEST-158
Signed-off-by: DR695H <dr695h@att.com>
robotframework-onap/ONAPLibrary/TemplatingKeywords.py

index 4ad959f..0e2a597 100644 (file)
@@ -15,6 +15,7 @@
 from jinja2 import Environment, FileSystemLoader, select_autoescape
 from robot import utils
 from robot.api.deco import keyword
+from string import Template
 
 
 class TemplatingKeywords(object):
@@ -39,3 +40,8 @@ class TemplatingKeywords(object):
         """returns a string that is the jinja template in template_location filled in via the dictionary in values """
         template = self._cache.switch(alias).get_template(template_location)
         return template.render(values)
+
+    @keyword
+    def template_string(self, template, values):
+        """Template String takes in a string and its values and converts it using the string.Template class"""
+        return Template(template).substitute(values)