Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
pkoch authored and TheLocehiliosan committed Feb 17, 2022
1 parent 73af421 commit b0e0856
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/test_unit_template_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,22 @@ def test_include(runner, yadm, tmpdir):
assert run.err == ''
assert output_file.read() == EXPECTED_INCLUDE
assert os.stat(output_file).st_mode == os.stat(input_file).st_mode


def test_env(runner, yadm, tmpdir):
"""Test env"""

input_file = tmpdir.join('input')
input_file.write('{{env.PWD}}', ensure=True)
input_file.chmod(FILE_MODE)
output_file = tmpdir.join('output')

script = f"""
YADM_TEST=1 source {yadm}
set_awk
template_default "{input_file}" "{output_file}"
"""
run = runner(command=['bash'], inp=script)
assert run.success
assert run.err == ''
assert output_file.read() == os.environ['PWD']

0 comments on commit b0e0856

Please sign in to comment.