aboutsummaryrefslogtreecommitdiffstats
path: root/molecule/default/tests/test_decryption_keys.py
diff options
context:
space:
mode:
Diffstat (limited to 'molecule/default/tests/test_decryption_keys.py')
-rw-r--r--molecule/default/tests/test_decryption_keys.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/molecule/default/tests/test_decryption_keys.py b/molecule/default/tests/test_decryption_keys.py
index c772477..bd5ff6a 100644
--- a/molecule/default/tests/test_decryption_keys.py
+++ b/molecule/default/tests/test_decryption_keys.py
@@ -46,9 +46,6 @@ def test_decryption_keys_structure_single_repo():
assert 'borg-client_borg-client:' in content, (
"Single repo host should have key named 'hostname_repo_name'"
)
- assert 'borg-client-2_borg-client-2:' in content, (
- "Second single repo host should have key named 'hostname_repo_name'"
- )
def test_decryption_keys_structure_multi_repo():
@@ -113,10 +110,23 @@ def test_decryption_keys_all_hosts_present():
expected_keys = [
'borg-client_borg-client:',
- 'borg-client-2_borg-client-2:',
'borg-client-multi_configs:',
'borg-client-multi_home-data:',
]
for key in expected_keys:
assert key in content, f"Expected key {key} not found in decryption_keys.yml"
+
+
+def test_no_keys_for_disabled_export():
+ """Test that no decryption keys are exported when disabled"""
+ keys_path = _get_keys_path()
+ if not os.path.exists(keys_path):
+ pytest.skip('decryption_keys.yml not yet generated')
+
+ with open(keys_path, 'r') as f:
+ content = f.read()
+
+ assert 'borg-client-2_borg-client-2:' not in content, (
+ 'Keys should not be exported for borg-client-2 (export disabled)'
+ )