|
@@ -33,6 +33,21 @@ def test_make_environment_with_passphrase_should_set_environment():
|
|
assert environment.get('BORG_PASSPHRASE') == 'pass'
|
|
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():
|
|
def test_make_environment_with_ssh_command_should_set_environment():
|
|
flexmock(module.borgmatic.borg.passcommand).should_receive(
|
|
flexmock(module.borgmatic.borg.passcommand).should_receive(
|
|
'get_passphrase_from_passcommand'
|
|
'get_passphrase_from_passcommand'
|