2018-12-11 06:20:57 +00:00
|
|
|
from borgmatic.borg import environment as module
|
|
|
|
|
|
|
|
|
2022-06-30 21:42:17 +01:00
|
|
|
def test_make_environment_with_passcommand_should_set_environment():
|
|
|
|
environment = module.make_environment({'encryption_passcommand': 'command'})
|
2018-12-11 06:20:57 +00:00
|
|
|
|
2022-06-30 21:42:17 +01:00
|
|
|
assert environment.get('BORG_PASSCOMMAND') == 'command'
|
2018-12-11 06:20:57 +00:00
|
|
|
|
|
|
|
|
2022-06-30 21:42:17 +01:00
|
|
|
def test_make_environment_with_passphrase_should_set_environment():
|
|
|
|
environment = module.make_environment({'encryption_passphrase': 'pass'})
|
2019-05-16 18:34:52 +01:00
|
|
|
|
2022-06-30 21:42:17 +01:00
|
|
|
assert environment.get('BORG_PASSPHRASE') == 'pass'
|
2019-08-26 17:39:41 +01:00
|
|
|
|
|
|
|
|
2022-06-30 21:42:17 +01:00
|
|
|
def test_make_environment_with_ssh_command_should_set_environment():
|
|
|
|
environment = module.make_environment({'ssh_command': 'ssh -C'})
|
2019-08-26 17:39:41 +01:00
|
|
|
|
2022-06-30 21:42:17 +01:00
|
|
|
assert environment.get('BORG_RSH') == 'ssh -C'
|
2020-06-06 22:30:04 +01:00
|
|
|
|
|
|
|
|
2022-06-30 21:42:17 +01:00
|
|
|
def test_make_environment_without_configuration_should_only_set_default_environment():
|
|
|
|
environment = module.make_environment({})
|
2020-06-06 22:30:04 +01:00
|
|
|
|
2022-06-30 21:42:17 +01:00
|
|
|
assert environment == {
|
|
|
|
'BORG_RELOCATED_REPO_ACCESS_IS_OK': 'no',
|
|
|
|
'BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK': 'no',
|
|
|
|
}
|
2020-06-21 22:41:22 +01:00
|
|
|
|
|
|
|
|
2022-06-30 21:42:17 +01:00
|
|
|
def test_make_environment_with_relocated_repo_access_should_override_default():
|
|
|
|
environment = module.make_environment({'relocated_repo_access_is_ok': True})
|
2020-06-21 22:41:22 +01:00
|
|
|
|
2022-06-30 21:42:17 +01:00
|
|
|
assert environment.get('BORG_RELOCATED_REPO_ACCESS_IS_OK') == 'yes'
|
2023-03-17 21:27:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_make_environment_with_integer_variable_value():
|
|
|
|
environment = module.make_environment({'borg_files_cache_ttl': 40})
|
|
|
|
assert environment.get('BORG_FILES_CACHE_TTL') == '40'
|