From: DR695H Date: Thu, 20 Jun 2019 19:34:53 +0000 (-0400) Subject: add string templating to new way X-Git-Tag: 6.0.0-ONAP~56 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=91e8c8866cf87a70b8d19fb095d30147723ac6ab;p=testsuite%2Fpython-testing-utils.git add string templating to new way Change-Id: Ic32be25a808a90948b77ce43c5fe4e5f1f59a1dd Issue-ID: TEST-158 Signed-off-by: DR695H --- 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)