1
0
Fork 0
mirror of synced 2024-12-13 02:45:45 -05:00
yadm/test/test_unit_query_distro.py
Tim Byrne e7f9616b39
Rewrite testing system (#119)
The new test system is written with py.test. These tests are more
comprehensive, run faster by an order of magnitude, and are far more
maintainable. The tests themselves conform to PEP8.
2019-02-20 07:48:25 -06:00

26 lines
693 B
Python

"""Unit tests: query_distro"""
def test_lsb_release_present(runner, yadm, tst_distro):
"""Match lsb_release -si when present"""
script = f"""
YADM_TEST=1 source {yadm}
query_distro
"""
run = runner(command=['bash'], inp=script)
assert run.success
assert run.err == ''
assert run.out.rstrip() == tst_distro
def test_lsb_release_missing(runner, yadm):
"""Empty value when missing"""
script = f"""
YADM_TEST=1 source {yadm}
LSB_RELEASE_PROGRAM="missing_lsb_release"
query_distro
"""
run = runner(command=['bash'], inp=script)
assert run.success
assert run.err == ''
assert run.out.rstrip() == ''