mirror of
https://github.com/TheLocehiliosan/yadm
synced 2024-10-27 20:34:27 +00:00
Assert existence of config file's parent directory
Fixes TheLocehiliosan/yadm#226 When a config file path is passed to yadm whose parent directory does not exist, git (and hence yadm) fails without writing the file. Yadm should, however, make sure that the directory exists s.t. git can just write to the file.
This commit is contained in:
parent
550a6b4340
commit
60b23e33e8
@ -137,3 +137,27 @@ def test_config_local_write(runner, yadm_y, paths, supported_local_configs):
|
||||
assert run.success
|
||||
assert run.err == ''
|
||||
assert run.out.strip() == f'value_of_{config}'
|
||||
|
||||
|
||||
def test_config_without_parent_directory(runner, yadm_y, paths):
|
||||
"""Write and read attribute to/from config file with non-existent parent directory
|
||||
|
||||
Update configuration file
|
||||
Display value
|
||||
Exit with 0
|
||||
"""
|
||||
|
||||
config_file = paths.root + '/folder/does/not/exist/config'
|
||||
|
||||
run = runner(yadm_y('--yadm-config', config_file, 'config', TEST_KEY, TEST_VALUE))
|
||||
|
||||
assert run.success
|
||||
assert run.err == ''
|
||||
assert run.out == ''
|
||||
|
||||
paths.config.write(TEST_FILE)
|
||||
run = runner(yadm_y('--yadm-config', config_file, 'config', TEST_KEY))
|
||||
|
||||
assert run.success
|
||||
assert run.err == ''
|
||||
assert run.out.strip() == TEST_VALUE
|
||||
|
Loading…
Reference in New Issue
Block a user