Browse Source

Fix restore paths list to tuple conversion.

Dan Helfman 6 years ago
parent
commit
fe92d9e838
2 changed files with 13 additions and 1 deletions
  1. 1 1
      borgmatic/borg/extract.py
  2. 12 0
      tests/unit/borg/test_extract.py

+ 1 - 1
borgmatic/borg/extract.py

@@ -72,7 +72,7 @@ def extract_archive(
 
     full_command = (
         (local_path, 'extract', '::'.join((repository, archive)))
-        + (restore_paths if restore_paths else ())
+        + (tuple(restore_paths) if restore_paths else ())
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--umask', str(umask)) if umask else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())

+ 12 - 0
tests/unit/borg/test_extract.py

@@ -103,6 +103,18 @@ def test_extract_last_archive_dry_run_calls_borg_with_lock_wait_parameters():
     module.extract_last_archive_dry_run(repository='repo', lock_wait=5)
 
 
+def test_extract_archive_calls_borg_with_restore_path_parameters():
+    insert_subprocess_mock(('borg', 'extract', 'repo::archive', 'path1', 'path2'))
+
+    module.extract_archive(
+        dry_run=False,
+        repository='repo',
+        archive='archive',
+        restore_paths=['path1', 'path2'],
+        storage_config={},
+    )
+
+
 def test_extract_archive_calls_borg_with_remote_path_parameters():
     insert_subprocess_mock(('borg', 'extract', 'repo::archive', '--remote-path', 'borg1'))