Migrate declarative configs to config/ dir and remove hardcoded paths
Replace all hardcoded /home/wall/vacuum-wall paths in lib/ with Path(__file__).resolve()
auto-discovery. Move config files from data/ to config/<subsystem>/config.json.
ACME now uses ACME_HOME env var and data/acme/ for cert storage. Systemd units
and sudoers use {{ USER_NAME }}, {{ PROJECT_DIR }}, {{ ACME_HOME }} Jinja2
template variables for install-time substitution. Remove sys.path.insert boot
strap from test files.
This commit is contained in:
@@ -1,25 +1,28 @@
|
||||
import sys
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
sys.path.insert(0, "/home/wall/vacuum-wall")
|
||||
|
||||
from lib import dnsmasq
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def temp_data_dir(tmp_path):
|
||||
original_config_dir = dnsmasq.CONFIG_DIR
|
||||
original = dnsmasq.DATA_DIR
|
||||
original_config = dnsmasq.CONFIG_PATH
|
||||
original_fragments = dnsmasq.FRAGMENTS_DIR
|
||||
dnsmasq.CONFIG_DIR = tmp_path / "dnsmasq"
|
||||
dnsmasq.DATA_DIR = tmp_path / "dnsmasq"
|
||||
dnsmasq.CONFIG_PATH = dnsmasq.DATA_DIR / "config.json"
|
||||
dnsmasq.CONFIG_PATH = dnsmasq.CONFIG_DIR / "config.json"
|
||||
dnsmasq.FRAGMENTS_DIR = dnsmasq.DATA_DIR / "fragments"
|
||||
dnsmasq.CONFIG_DIR.mkdir(parents=True, exist_ok=True)
|
||||
dnsmasq.DATA_DIR.mkdir(parents=True, exist_ok=True)
|
||||
dnsmasq.FRAGMENTS_DIR.mkdir(parents=True, exist_ok=True)
|
||||
yield tmp_path
|
||||
dnsmasq.CONFIG_DIR = original_config_dir
|
||||
dnsmasq.DATA_DIR = original
|
||||
dnsmasq.CONFIG_PATH = original_config
|
||||
dnsmasq.FRAGMENTS_DIR = original_fragments
|
||||
|
||||
|
||||
class TestDeepMerge:
|
||||
|
||||
Reference in New Issue
Block a user