summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDR695H <dr695h@att.com>2019-06-20 15:34:53 -0400
committerDR695H <dr695h@att.com>2019-06-20 15:35:15 -0400
commit91e8c8866cf87a70b8d19fb095d30147723ac6ab (patch)
tree2de015fac9489df1fb77b5b23511729daafd3992
parent42a82cbaf32ce8dffafdcec71cbbe250ab8eb58c (diff)
add string templating to new way
Change-Id: Ic32be25a808a90948b77ce43c5fe4e5f1f59a1dd Issue-ID: TEST-158 Signed-off-by: DR695H <dr695h@att.com>
-rw-r--r--robotframework-onap/ONAPLibrary/TemplatingKeywords.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/robotframework-onap/ONAPLibrary/TemplatingKeywords.py b/robotframework-onap/ONAPLibrary/TemplatingKeywords.py
index 4ad959f..0e2a597 100644
--- a/robotframework-onap/ONAPLibrary/TemplatingKeywords.py
+++ b/robotframework-onap/ONAPLibrary/TemplatingKeywords.py
@@ -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)