mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-26 17:57:59 +00:00
move rename cmd tests to own module
This commit is contained in:
parent
a07311101a
commit
620d51d6bc
2 changed files with 26 additions and 20 deletions
|
@ -1604,26 +1604,6 @@ def test_overwrite(self):
|
|||
with changedir("output"):
|
||||
self.cmd(f"--repo={self.repository_location}", "extract", "test", exit_code=1)
|
||||
|
||||
def test_rename(self):
|
||||
self.create_regular_file("file1", size=1024 * 80)
|
||||
self.create_regular_file("dir2/file2", size=1024 * 80)
|
||||
self.cmd(f"--repo={self.repository_location}", "rcreate", RK_ENCRYPTION)
|
||||
self.cmd(f"--repo={self.repository_location}", "create", "test", "input")
|
||||
self.cmd(f"--repo={self.repository_location}", "create", "test.2", "input")
|
||||
self.cmd(f"--repo={self.repository_location}", "extract", "test", "--dry-run")
|
||||
self.cmd(f"--repo={self.repository_location}", "extract", "test.2", "--dry-run")
|
||||
self.cmd(f"--repo={self.repository_location}", "rename", "test", "test.3")
|
||||
self.cmd(f"--repo={self.repository_location}", "extract", "test.2", "--dry-run")
|
||||
self.cmd(f"--repo={self.repository_location}", "rename", "test.2", "test.4")
|
||||
self.cmd(f"--repo={self.repository_location}", "extract", "test.3", "--dry-run")
|
||||
self.cmd(f"--repo={self.repository_location}", "extract", "test.4", "--dry-run")
|
||||
# Make sure both archives have been renamed
|
||||
with Repository(self.repository_path) as repository:
|
||||
manifest = Manifest.load(repository, Manifest.NO_OPERATION_CHECK)
|
||||
self.assert_equal(len(manifest.archives), 2)
|
||||
self.assert_in("test.3", manifest.archives)
|
||||
self.assert_in("test.4", manifest.archives)
|
||||
|
||||
def test_info(self):
|
||||
self.create_regular_file("file1", size=1024 * 80)
|
||||
self.cmd(f"--repo={self.repository_location}", "rcreate", RK_ENCRYPTION)
|
||||
|
|
26
src/borg/testsuite/archiver/rename_cmd.py
Normal file
26
src/borg/testsuite/archiver/rename_cmd.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
from ...constants import * # NOQA
|
||||
from ...manifest import Manifest
|
||||
from ...repository import Repository
|
||||
from . import ArchiverTestCaseBase, RK_ENCRYPTION
|
||||
|
||||
|
||||
class ArchiverTestCase(ArchiverTestCaseBase):
|
||||
def test_rename(self):
|
||||
self.create_regular_file("file1", size=1024 * 80)
|
||||
self.create_regular_file("dir2/file2", size=1024 * 80)
|
||||
self.cmd(f"--repo={self.repository_location}", "rcreate", RK_ENCRYPTION)
|
||||
self.cmd(f"--repo={self.repository_location}", "create", "test", "input")
|
||||
self.cmd(f"--repo={self.repository_location}", "create", "test.2", "input")
|
||||
self.cmd(f"--repo={self.repository_location}", "extract", "test", "--dry-run")
|
||||
self.cmd(f"--repo={self.repository_location}", "extract", "test.2", "--dry-run")
|
||||
self.cmd(f"--repo={self.repository_location}", "rename", "test", "test.3")
|
||||
self.cmd(f"--repo={self.repository_location}", "extract", "test.2", "--dry-run")
|
||||
self.cmd(f"--repo={self.repository_location}", "rename", "test.2", "test.4")
|
||||
self.cmd(f"--repo={self.repository_location}", "extract", "test.3", "--dry-run")
|
||||
self.cmd(f"--repo={self.repository_location}", "extract", "test.4", "--dry-run")
|
||||
# Make sure both archives have been renamed
|
||||
with Repository(self.repository_path) as repository:
|
||||
manifest = Manifest.load(repository, Manifest.NO_OPERATION_CHECK)
|
||||
self.assert_equal(len(manifest.archives), 2)
|
||||
self.assert_in("test.3", manifest.archives)
|
||||
self.assert_in("test.4", manifest.archives)
|
Loading…
Reference in a new issue