2018-12-11 07:20:57 +01:00
|
|
|
from borgmatic.borg import environment as module
|
|
|
|
|
|
|
|
|
2022-06-30 22:42:17 +02:00
|
|
|
def test_make_environment_with_passcommand_should_set_environment():
|
|
|
|
environment = module.make_environment({'encryption_passcommand': 'command'})
|
2018-12-11 07:20:57 +01:00
|
|
|
|
2022-06-30 22:42:17 +02:00
|
|
|
assert environment.get('BORG_PASSCOMMAND') == 'command'
|
2018-12-11 07:20:57 +01:00
|
|
|
|
|
|
|
|
2022-06-30 22:42:17 +02:00
|
|
|
def test_make_environment_with_passphrase_should_set_environment():
|
|
|
|
environment = module.make_environment({'encryption_passphrase': 'pass'})
|
2019-05-16 19:34:52 +02:00
|
|
|
|
2022-06-30 22:42:17 +02:00
|
|
|
assert environment.get('BORG_PASSPHRASE') == 'pass'
|
2019-08-26 18:39:41 +02:00
|
|
|
|
|
|
|
|
2022-06-30 22:42:17 +02:00
|
|
|
def test_make_environment_with_ssh_command_should_set_environment():
|
|
|
|
environment = module.make_environment({'ssh_command': 'ssh -C'})
|
2019-08-26 18:39:41 +02:00
|
|
|
|
2022-06-30 22:42:17 +02:00
|
|
|
assert environment.get('BORG_RSH') == 'ssh -C'
|
2020-06-06 23:30:04 +02:00
|
|
|
|
|
|
|
|
2022-06-30 22:42:17 +02:00
|
|
|
def test_make_environment_without_configuration_should_only_set_default_environment():
|
|
|
|
environment = module.make_environment({})
|
2020-06-06 23:30:04 +02:00
|
|
|
|
2022-06-30 22:42:17 +02:00
|
|
|
assert environment == {
|
|
|
|
'BORG_RELOCATED_REPO_ACCESS_IS_OK': 'no',
|
|
|
|
'BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK': 'no',
|
2023-07-09 11:45:51 +02:00
|
|
|
'BORG_CHECK_I_KNOW_WHAT_I_AM_DOING': 'NO',
|
2022-06-30 22:42:17 +02:00
|
|
|
}
|
2020-06-21 23:41:22 +02:00
|
|
|
|
|
|
|
|
2022-06-30 22:42:17 +02: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 23:41:22 +02:00
|
|
|
|
2022-06-30 22:42:17 +02:00
|
|
|
assert environment.get('BORG_RELOCATED_REPO_ACCESS_IS_OK') == 'yes'
|
2023-03-17 22:27:56 +01:00
|
|
|
|
|
|
|
|
2023-07-09 11:45:51 +02:00
|
|
|
def test_make_environment_check_i_know_what_i_am_doing_should_override_default():
|
|
|
|
environment = module.make_environment({'check_i_know_what_i_am_doing': True})
|
|
|
|
|
|
|
|
assert environment.get('BORG_CHECK_I_KNOW_WHAT_I_AM_DOING') == 'YES'
|
|
|
|
|
|
|
|
|
2023-03-17 22:27:56 +01: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'
|