2018-07-11 12:50:42 +00:00
|
|
|
"""Unit tests: bootstrap_available"""
|
|
|
|
|
|
|
|
|
|
|
|
def test_bootstrap_missing(runner, paths):
|
|
|
|
"""Test result of bootstrap_available, when bootstrap missing"""
|
|
|
|
run_test(runner, paths, False)
|
|
|
|
|
|
|
|
|
|
|
|
def test_bootstrap_no_exec(runner, paths):
|
|
|
|
"""Test result of bootstrap_available, when bootstrap not executable"""
|
2023-07-10 19:43:17 +00:00
|
|
|
paths.bootstrap.write("")
|
2018-07-11 12:50:42 +00:00
|
|
|
paths.bootstrap.chmod(0o644)
|
|
|
|
run_test(runner, paths, False)
|
|
|
|
|
|
|
|
|
|
|
|
def test_bootstrap_exec(runner, paths):
|
|
|
|
"""Test result of bootstrap_available, when bootstrap executable"""
|
2023-07-10 19:43:17 +00:00
|
|
|
paths.bootstrap.write("")
|
2018-07-11 12:50:42 +00:00
|
|
|
paths.bootstrap.chmod(0o775)
|
|
|
|
run_test(runner, paths, True)
|
|
|
|
|
|
|
|
|
|
|
|
def run_test(runner, paths, success):
|
|
|
|
"""Run bootstrap_available, and test result"""
|
|
|
|
script = f"""
|
|
|
|
YADM_TEST=1 source {paths.pgm}
|
|
|
|
YADM_BOOTSTRAP='{paths.bootstrap}'
|
|
|
|
bootstrap_available
|
|
|
|
"""
|
2023-07-10 19:43:17 +00:00
|
|
|
run = runner(command=["bash"], inp=script)
|
2018-07-11 12:50:42 +00:00
|
|
|
assert run.success == success
|
2023-07-10 19:43:17 +00:00
|
|
|
assert run.err == ""
|
|
|
|
assert run.out == ""
|