Additional test coverage (#966).

This commit is contained in:
Dan Helfman
2025-02-10 10:05:51 -08:00
parent 73fe29b055
commit 24b846e9ca
+15
View File
@@ -33,6 +33,21 @@ def test_make_environment_with_passphrase_should_set_environment():
assert environment.get('BORG_PASSPHRASE') == 'pass'
def test_make_environment_with_credential_tag_passphrase_should_load_it_and_set_environment():
flexmock(module.borgmatic.borg.passcommand).should_receive(
'get_passphrase_from_passcommand'
).and_return(None)
flexmock(module.os).should_receive('pipe').never()
flexmock(module.os.environ).should_receive('get').and_return(None)
flexmock(module.borgmatic.hooks.credential.tag).should_receive('resolve_credential').with_args(
'!credential systemd pass'
).and_return('pass')
environment = module.make_environment({'encryption_passphrase': '!credential systemd pass'})
assert environment.get('BORG_PASSPHRASE') == 'pass'
def test_make_environment_with_ssh_command_should_set_environment():
flexmock(module.borgmatic.borg.passcommand).should_receive(
'get_passphrase_from_passcommand'