salt/pkg/windows/nsis/tests/config_tests/test_old_install.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
1 KiB
Python
Raw Normal View History

2022-12-23 21:39:06 -07:00
import os
2022-12-26 18:44:06 -07:00
import pytest
2022-12-23 21:39:06 -07:00
@pytest.fixture(scope="module")
def install():
pytest.helpers.clean_env()
# Create old config
pytest.helpers.old_install()
args = ["/S"]
pytest.helpers.install_salt(args)
yield args
2022-12-23 21:39:06 -07:00
pytest.helpers.clean_env()
def test_binaries_present_old_location(install):
# This will show the contents of the directory on failure
dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin")
# Apparently we don't move the binaries even if they pass install-dir
# TODO: Decide if this is expected behavior
assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe")
2022-12-23 21:39:06 -07:00
assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe")
def test_config_present_old_location(install):
assert os.path.exists(rf"{pytest.OLD_DIR}\conf\minion")
def test_config_correct(install):
# The config file should be the old existing config, unchanged
expected = pytest.OLD_CONTENT
with open(rf"{pytest.OLD_DIR}\conf\minion") as f:
result = f.readlines()
assert result == expected