From 4597540ad8531558d7bc2cb103e51541319a9d3d Mon Sep 17 00:00:00 2001 From: sascha Date: Wed, 22 Jul 2026 11:23:53 +0200 Subject: [PATCH] sync: tests/test_vault_sync.py for Butler 2.3.2 --- tests/test_vault_sync.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/test_vault_sync.py diff --git a/tests/test_vault_sync.py b/tests/test_vault_sync.py new file mode 100644 index 0000000..2353f46 --- /dev/null +++ b/tests/test_vault_sync.py @@ -0,0 +1,27 @@ +from pathlib import Path +import re + + +ROOT = Path(__file__).resolve().parents[1] + + +def test_vault_cache_is_a_persistent_named_volume(): + compose = (ROOT / "compose.yaml").read_text() + assert "vault-cache:/data/vault-cache" in compose + assert "volumes:\n vault-cache:" in compose + + +def test_vault_sync_uses_protected_environment_instead_of_embedded_password(): + script = (ROOT / "vault-sync.sh").read_text() + assert '.vault-sync.env' in script + assert not re.search(r'export BW_PASSWORD=["\'](?!\$)', script) + assert 'BW_CLIENTID' in script + assert 'BW_CLIENTSECRET' in script + assert 'bw login --apikey' in script + assert 'bw unlock --passwordenv BW_PASSWORD' in script + + +def test_vault_sync_runtime_files_are_not_tracked(): + gitignore = (ROOT / ".gitignore").read_text().splitlines() + assert ".vault-sync.env" in gitignore + assert "vault-sync.log" in gitignore