Skip to content

Commit

Permalink
Adding tests for DiffSK#187
Browse files Browse the repository at this point in the history
  • Loading branch information
LucidOne committed Jul 6, 2019
1 parent 9d7a288 commit 6d166d9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/tests/conf_envsubst.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/python
import sys
import configobj

print configobj.ConfigObj(sys.argv[1])
4 changes: 4 additions & 0 deletions src/tests/envsubst.ini.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Template test

shell = ${SHELL}

18 changes: 18 additions & 0 deletions src/tests/test_validate_envsubst.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# *- coding: utf-8 -*-
# pylint: disable=wildcard-import, missing-docstring, no-self-use, bad-continuation
# pylint: disable=invalid-name, redefined-outer-name, too-few-public-methods

import os

import pytest
import subprocess

@pytest.fixture()
def thisdir():
return os.path.dirname(os.path.join(os.getcwd(), __file__))


def test_validate_template(thisdir,capsys):
templatepath = os.path.join(thisdir, 'envsubst.ini.template')
out = subprocess.check_output(["bash","-c","python %s/conf_envsubst.py <(envsubst < %s)"%(thisdir,templatepath)], env={"SHELL": "/bin/bash"})
assert out.decode() == "{'shell': '/bin/bash'}\n"

0 comments on commit 6d166d9

Please sign in to comment.