38 lines
1008 B
Python
38 lines
1008 B
Python
from pathlib import Path
|
|
import subprocess
|
|
import tempfile
|
|
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
|
SCRIPT_PATH = REPO_ROOT / "deploy" / "render_nas_env.py"
|
|
ENV_TEMPLATE = REPO_ROOT / ".env.example"
|
|
|
|
|
|
def test_render_nas_env_should_generate_lsfx_mock_db_override_file():
|
|
with tempfile.TemporaryDirectory() as tmp_dir:
|
|
output_path = Path(tmp_dir) / ".env"
|
|
|
|
result = subprocess.run(
|
|
[
|
|
"python3",
|
|
str(SCRIPT_PATH),
|
|
"--template",
|
|
str(ENV_TEMPLATE),
|
|
"--output",
|
|
str(output_path),
|
|
],
|
|
cwd=REPO_ROOT,
|
|
capture_output=True,
|
|
text=True,
|
|
)
|
|
|
|
assert result.returncode == 0
|
|
assert output_path.exists()
|
|
|
|
env_text = output_path.read_text(encoding="utf-8")
|
|
|
|
assert "CCDI_DB_HOST=192.168.0.111" in env_text
|
|
assert "CCDI_DB_PORT=40628" in env_text
|
|
assert "CCDI_DB_NAME=ccdi" in env_text
|
|
|