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 an existing config
|
|
|
|
pytest.helpers.existing_config()
|
|
|
|
# Create a custom config
|
|
|
|
pytest.helpers.custom_config()
|
2024-07-11 10:40:46 -06:00
|
|
|
args = ["/S", "/custom-config=custom_conf"]
|
|
|
|
pytest.helpers.install_salt(args)
|
|
|
|
yield args
|
2022-12-23 21:39:06 -07:00
|
|
|
pytest.helpers.clean_env()
|
|
|
|
|
|
|
|
|
|
|
|
def test_binaries_present(install):
|
2024-07-11 10:40:46 -06:00
|
|
|
# This will show the contents of the directory on failure
|
|
|
|
inst_dir = pytest.INST_DIR
|
|
|
|
inst_dir_exists = os.path.exists(inst_dir)
|
|
|
|
dir_contents = os.listdir(inst_dir)
|
|
|
|
assert os.path.exists(rf"{inst_dir}\ssm.exe")
|
2022-12-23 21:39:06 -07:00
|
|
|
|
|
|
|
|
|
|
|
def test_config_present(install):
|
|
|
|
assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion")
|
|
|
|
|
|
|
|
|
|
|
|
def test_config_correct(install):
|
|
|
|
# The config file should be the custom config, unchanged
|
2024-07-11 10:40:46 -06:00
|
|
|
with open(rf"{pytest.SCRIPT_DIR}\custom_conf") as f:
|
2022-12-23 21:39:06 -07:00
|
|
|
expected = f.readlines()
|
|
|
|
|
|
|
|
with open(rf"{pytest.DATA_DIR}\conf\minion") as f:
|
|
|
|
result = f.readlines()
|
|
|
|
|
|
|
|
assert result == expected
|