30fa6f08a4
* Update base image to Ubuntu 24.10. This uses a python version where j2cli no longer works when installed using pip so use the version from Ubuntu instead which has been patched to work. * Update shellcheck, pylint, pytest, isort, flake8, black and yamllint to the latest versions. This closes #502. * Use a longer expect timeout to fix tests failing when gpg is killed due to this timeout. * Explicitly flush gpg-agent's cached passwords to fix failing tests with latest gnupg. Also clean up after tests to avoid having gpg-agents running after the test (e.g. when running tests directly without docker).
31 lines
832 B
Python
31 lines
832 B
Python
"""Unit tests: report_invalid_alts"""
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.mark.parametrize("valid", [True, False], ids=["valid", "no_valid"])
|
|
@pytest.mark.parametrize("previous", [True, False], ids=["prev", "no_prev"])
|
|
def test_report_invalid_alts(runner, yadm, valid, previous):
|
|
"""Use report_invalid_alts"""
|
|
|
|
lwi = ""
|
|
alts = "INVALID_ALT=()"
|
|
if previous:
|
|
lwi = "LEGACY_WARNING_ISSUED=1"
|
|
if not valid:
|
|
alts = 'INVALID_ALT=("file##invalid")'
|
|
|
|
script = f"""
|
|
YADM_TEST=1 source {yadm}
|
|
{lwi}
|
|
{alts}
|
|
report_invalid_alts
|
|
"""
|
|
run = runner(command=["bash"], inp=script)
|
|
assert run.success
|
|
assert run.out == ""
|
|
if not valid and not previous:
|
|
assert "WARNING" in run.err
|
|
assert "file##invalid" in run.err
|
|
else:
|
|
assert run.err == ""
|