Skip to content

Commit 6d166d9

Browse files
committedJul 6, 2019
Adding tests for #187
1 parent 9d7a288 commit 6d166d9

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed
 

‎src/tests/conf_envsubst.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/python
2+
import sys
3+
import configobj
4+
5+
print configobj.ConfigObj(sys.argv[1])

‎src/tests/envsubst.ini.template

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Template test
2+
3+
shell = ${SHELL}
4+

‎src/tests/test_validate_envsubst.py

+18
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","python %s/conf_envsubst.py <(envsubst < %s)"%(thisdir,templatepath)], env={"SHELL": "/bin/bash"})
18+
assert out.decode() == "{'shell': '/bin/bash'}\n"

0 commit comments

Comments
 (0)