|
@@ -50,6 +50,16 @@ def test_apply_constants_with_empty_constants_passes_through_value():
|
|
|
({'before_backup': '{inject}'}, {'before_backup': "'echo hi; naughty-command'"}),
|
|
|
({'after_backup': '{inject}'}, {'after_backup': "'echo hi; naughty-command'"}),
|
|
|
({'on_error': '{inject}'}, {'on_error': "'echo hi; naughty-command'"}),
|
|
|
+ (
|
|
|
+ {
|
|
|
+ 'before_backup': '{env_pass}',
|
|
|
+ 'postgresql_databases': [{'name': 'users', 'password': '{env_pass}'}],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ 'before_backup': "'${PASS}'",
|
|
|
+ 'postgresql_databases': [{'name': 'users', 'password': '${PASS}'}],
|
|
|
+ },
|
|
|
+ ),
|
|
|
(3, 3),
|
|
|
(True, True),
|
|
|
(False, False),
|
|
@@ -63,6 +73,7 @@ def test_apply_constants_makes_string_substitutions(value, expected_value):
|
|
|
'int': 3,
|
|
|
'bool': True,
|
|
|
'inject': 'echo hi; naughty-command',
|
|
|
+ 'env_pass': '${PASS}',
|
|
|
}
|
|
|
|
|
|
assert module.apply_constants(value, constants) == expected_value
|