Skip to content

Commit ae4b6ab

Browse files
committed
Added tests for <(envsubst < template)
1 parent 8b27128 commit ae4b6ab

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

src/tests/conf_envsubst.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import sys
2+
import configobj
3+
4+
print(configobj.ConfigObj(sys.argv[1]))

src/tests/envsubst.ini.template

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Template test
2+
3+
shell = ${SHELL}
4+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# *- coding: utf-8 -*-
2+
# pylint: disable=wildcard-import, missing-docstring, no-self-use, bad-continuation
3+
# pylint: disable=invalid-name, redefined-outer-name, too-few-public-methods
4+
5+
import os
6+
7+
import pytest
8+
import subprocess
9+
10+
@pytest.fixture()
11+
def thisdir():
12+
return os.path.dirname(os.path.join(os.getcwd(), __file__))
13+
14+
15+
def test_validate_template(thisdir,capsys):
16+
templatepath = os.path.join(thisdir, 'envsubst.ini.template')
17+
out = subprocess.check_output(["bash","-c","export SHELL=/bin/bash && python %s/conf_envsubst.py <(envsubst < %s)"%(thisdir,templatepath)])
18+
assert out.decode() == "{'shell': '/bin/bash'}\n"

0 commit comments

Comments
 (0)