Exemplo n.º 1
0
 def __init__(self, os_target: str):
     self.log = jinja2.make_logging_undefined(logger=log)
     self.location = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
     self.os_target = os_target
     self.templates_folders = get_folder_structure_recursively(os.path.join(self.location, 'templates', os_target),
                                                               ('.*j2',))
     self.env = jinja2.Environment(loader=jinja2.FileSystemLoader(self.templates_folders), autoescape=True)
Exemplo n.º 2
0
def test_get_folder_structure_recursively(mock_exists, mock_walk, mock_data,
                                          ignore, res):
    mock_exists.return_value = True
    mock_walk.return_value = mock_data
    out = list(
        map(lambda path: pathlib.Path(path).as_posix(),
            utilities.get_folder_structure_recursively('', ignore)))
    assert out == res  # noqa: S101  # nosec