Make inputs and backup_dir optional in the config file
They can come from -i and -o; missing ones were rejected as a bad configuration file (exit code 6).
This commit is contained in:
@@ -170,6 +170,15 @@ ssh_keyfile=/keys/id
|
||||
assert b.keep == 0
|
||||
assert (b.ssh_host, b.ssh_user, b.ssh_keyfile) == ('cli-host', 'cli-user', '/cli/key')
|
||||
|
||||
def test_inputs_and_output_only_from_cli(self, run_cli: RunCli, tmp_path: Path) -> None:
|
||||
config_file = tmp_path / 'simple_backup.conf'
|
||||
config_file.write_text('[backup]\nkeep=3\n')
|
||||
|
||||
assert run_cli('-c', str(config_file), '-i', '/cli/in', '-o', '/cli/out') == 0
|
||||
|
||||
b = last_backup()
|
||||
assert (b.inputs, b.output, b.keep) == (['/cli/in'], '/cli/out', 3)
|
||||
|
||||
def test_ssh_host_and_user_from_cli_and_config(self, run_cli: RunCli, config: Callable[[str], str]) -> None:
|
||||
config_file = config('backup_dir=/backups\n[server]\nssh_user=user')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user