1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 01:37:20 +00:00

move transfer cmd tests to own module

This commit is contained in:
Thomas Waldmann 2022-09-12 23:37:26 +02:00
parent 35d2710769
commit e27bb0c1d0
2 changed files with 30 additions and 26 deletions

View file

@ -2091,32 +2091,6 @@ def test_do_not_mention_archive_if_you_can_not_find_repo(self):
self.assert_in("this-repository-does-not-exist", output)
self.assert_not_in("this-repository-does-not-exist::test", output)
def test_transfer(self):
def check_repo(repo_option):
listing = self.cmd(repo_option, "rlist", "--short")
assert "arch1" in listing
assert "arch2" in listing
listing = self.cmd(repo_option, "list", "--short", "arch1")
assert "file1" in listing
assert "dir2/file2" in listing
self.cmd(repo_option, "check")
self.create_test_files()
repo1 = f"--repo={self.repository_location}1"
repo2 = f"--repo={self.repository_location}2"
other_repo1 = f"--other-repo={self.repository_location}1"
self.cmd(repo1, "rcreate", RK_ENCRYPTION)
self.cmd(repo1, "create", "arch1", "input")
self.cmd(repo1, "create", "arch2", "input")
check_repo(repo1)
self.cmd(repo2, "rcreate", RK_ENCRYPTION, other_repo1)
self.cmd(repo2, "transfer", other_repo1, "--dry-run")
self.cmd(repo2, "transfer", other_repo1)
self.cmd(repo2, "transfer", other_repo1, "--dry-run")
check_repo(repo2)
class ArchiverTestCaseBinaryBase:
EXE = "borg.exe"

View file

@ -0,0 +1,30 @@
from ...constants import * # NOQA
from . import ArchiverTestCaseBase, RK_ENCRYPTION
class ArchiverTestCase(ArchiverTestCaseBase):
def test_transfer(self):
def check_repo(repo_option):
listing = self.cmd(repo_option, "rlist", "--short")
assert "arch1" in listing
assert "arch2" in listing
listing = self.cmd(repo_option, "list", "--short", "arch1")
assert "file1" in listing
assert "dir2/file2" in listing
self.cmd(repo_option, "check")
self.create_test_files()
repo1 = f"--repo={self.repository_location}1"
repo2 = f"--repo={self.repository_location}2"
other_repo1 = f"--other-repo={self.repository_location}1"
self.cmd(repo1, "rcreate", RK_ENCRYPTION)
self.cmd(repo1, "create", "arch1", "input")
self.cmd(repo1, "create", "arch2", "input")
check_repo(repo1)
self.cmd(repo2, "rcreate", RK_ENCRYPTION, other_repo1)
self.cmd(repo2, "transfer", other_repo1, "--dry-run")
self.cmd(repo2, "transfer", other_repo1)
self.cmd(repo2, "transfer", other_repo1, "--dry-run")
check_repo(repo2)