mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
backups: Rename repo_path to borg_path for clarity
borg_path clearly signifies that it is to be used by borg and consumers of the class will not be confused by it. Also rename some repo_path variables in test cases. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
5865fbea26
commit
d05bbab751
3 files changed
+29
-30
No files matched your search
@@ -87,8 +87,8 @@ def test_empty_dir(backup_directory):
|
||||
|
||||
def test_create_unencrypted_repository(backup_directory):
|
||||
"""Test creating an unencrypted repository."""
|
||||
repo_path = backup_directory / 'borgbackup'
|
||||
repository = BorgRepository(str(repo_path))
|
||||
path = backup_directory / 'borgbackup'
|
||||
repository = BorgRepository(str(path))
|
||||
repository.create_repository()
|
||||
info = repository.get_info()
|
||||
assert 'encryption' in info
|
||||
@@ -103,11 +103,11 @@ def test_create_export_delete_archive(data_directory, backup_directory):
|
||||
"""
|
||||
repo_name = 'test_create_and_delete'
|
||||
archive_name = 'first_archive'
|
||||
repo_path = backup_directory / repo_name
|
||||
path = backup_directory / repo_name
|
||||
|
||||
repository = BorgRepository(str(repo_path))
|
||||
repository = BorgRepository(str(path))
|
||||
repository.create_repository()
|
||||
archive_path = "::".join([str(repo_path), archive_name])
|
||||
archive_path = "::".join([str(path), archive_name])
|
||||
actions.superuser_run('backups', [
|
||||
'create-archive', '--path', archive_path, '--paths',
|
||||
str(data_directory)
|
||||
@@ -129,12 +129,12 @@ def test_remote_backup_actions():
|
||||
This relies on borgbackups being installed on the remote machine.
|
||||
"""
|
||||
credentials = _get_credentials(add_encryption_passphrase=True)
|
||||
repo_path = os.path.join(test_config.backups_ssh_path, str(uuid.uuid1()))
|
||||
arguments = ['init', '--path', repo_path, '--encryption', 'repokey']
|
||||
path = os.path.join(test_config.backups_ssh_path, str(uuid.uuid1()))
|
||||
arguments = ['init', '--path', path, '--encryption', 'repokey']
|
||||
arguments, kwargs = _append_borg_arguments(arguments, credentials)
|
||||
actions.superuser_run('backups', arguments, **kwargs)
|
||||
|
||||
arguments = ['info', '--path', repo_path]
|
||||
arguments = ['info', '--path', path]
|
||||
arguments, kwargs = _append_borg_arguments(arguments, credentials)
|
||||
info = actions.superuser_run('backups', arguments, **kwargs)
|
||||
info = json.loads(info)
|
||||
|
||||
@@ -92,25 +92,25 @@ def test_user_setup(temp_home, temp_user):
|
||||
@pytest.mark.skip
|
||||
def test_add_repository_when_directory_is_missing(temp_user, temp_home,
|
||||
password):
|
||||
repo_path = os.path.join(temp_home, 'non_existent_dir')
|
||||
remote_path = os.path.join(temp_home, 'non_existent_dir')
|
||||
data = {
|
||||
'repository': f'{temp_user}@localhost:{repo_path}',
|
||||
'repository': f'{temp_user}@localhost:{remote_path}',
|
||||
'ssh_password': password,
|
||||
'encryption': 'none'
|
||||
}
|
||||
# TODO test the view instead of the form
|
||||
form = forms.AddRemoteRepositoryForm(data=data)
|
||||
form.is_valid()
|
||||
assert os.path.isdir(repo_path) # Directory gets created
|
||||
assert os.path.isdir(remote_path) # Directory gets created
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
def test_add_repository_when_directory_exists_and_empty(
|
||||
temp_user, temp_home, password):
|
||||
repo_path = os.path.join(temp_home, 'empty_dir')
|
||||
os.makedirs(repo_path)
|
||||
remote_path = os.path.join(temp_home, 'empty_dir')
|
||||
os.makedirs(remote_path)
|
||||
data = {
|
||||
'repository': f'{temp_user}@localhost:{repo_path}',
|
||||
'repository': f'{temp_user}@localhost:{remote_path}',
|
||||
'ssh_password': password,
|
||||
'encryption': 'none'
|
||||
}
|
||||
@@ -123,11 +123,11 @@ def test_add_repository_when_directory_exists_and_empty(
|
||||
@pytest.mark.skip
|
||||
def test_add_repository_when_directory_exists_and_not_empty(
|
||||
temp_user, temp_home, password):
|
||||
repo_path = os.path.join(temp_home, 'non_empty_dir')
|
||||
os.makedirs(repo_path)
|
||||
open(os.path.join(repo_path, 'somefile.txt'), 'w').close()
|
||||
remote_path = os.path.join(temp_home, 'non_empty_dir')
|
||||
os.makedirs(remote_path)
|
||||
open(os.path.join(remote_path, 'somefile.txt'), 'w').close()
|
||||
data = {
|
||||
'repository': f'{temp_user}@localhost:{repo_path}',
|
||||
'repository': f'{temp_user}@localhost:{remote_path}',
|
||||
'ssh_password': password,
|
||||
'encryption': 'none'
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user