From 91e8c8866cf87a70b8d19fb095d30147723ac6ab Mon Sep 17 00:00:00 2001 From: DR695H Date: Thu, 20 Jun 2019 15:34:53 -0400 Subject: add string templating to new way Change-Id: Ic32be25a808a90948b77ce43c5fe4e5f1f59a1dd Issue-ID: TEST-158 Signed-off-by: DR695H --- robotframework-onap/ONAPLibrary/TemplatingKeywords.py | 6 ++++++ 1 file changed, 6 insertions(+) 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) -- cgit 1.2.3-korg