backups: yapf fixes

Reviewed-by: Michael Pimmer <info@fonfon.at>
This commit is contained in:
Sunil Mohan Adapa 2019-01-07 14:18:05 -08:00 committed by Michael Pimmer
parent f4b0c4dc9f
commit 039461b846
No known key found for this signature in database
GPG Key ID: 9D8E5DADBF92BF7D

View File

@ -52,9 +52,7 @@ class TestBackups(unittest.TestCase):
# grant access # grant access
nonexisting_repo_url = "user@%s.com.au:~/repo" % str(uuid.uuid1()) nonexisting_repo_url = "user@%s.com.au:~/repo" % str(uuid.uuid1())
inaccessible_repo_url = "user@heise.de:~/repo" inaccessible_repo_url = "user@heise.de:~/repo"
dummy_credentials = { dummy_credentials = {'ssh_password': 'invalid_password'}
'ssh_password': 'invalid_password'
}
repokey_encryption_passphrase = '12345' repokey_encryption_passphrase = '12345'
@classmethod @classmethod
@ -62,12 +60,12 @@ class TestBackups(unittest.TestCase):
"""Initial setup for all the classes.""" """Initial setup for all the classes."""
cls.action_directory = tempfile.TemporaryDirectory() cls.action_directory = tempfile.TemporaryDirectory()
cls.backup_directory = tempfile.TemporaryDirectory() cls.backup_directory = tempfile.TemporaryDirectory()
cls.data_directory = os.path.join(os.path.dirname( cls.data_directory = os.path.join(
os.path.realpath(__file__)), 'backup_data') os.path.dirname(os.path.realpath(__file__)), 'backup_data')
cls.actions_dir_factory = cfg.actions_dir cls.actions_dir_factory = cfg.actions_dir
cfg.actions_dir = cls.action_directory.name cfg.actions_dir = cls.action_directory.name
actions_dir = os.path.join(os.path.dirname(__file__), '..', '..', '..', actions_dir = os.path.join(
'..', 'actions') os.path.dirname(__file__), '..', '..', '..', '..', 'actions')
shutil.copy(os.path.join(actions_dir, 'backups'), cfg.actions_dir) shutil.copy(os.path.join(actions_dir, 'backups'), cfg.actions_dir)
shutil.copy(os.path.join(actions_dir, 'sshfs'), cfg.actions_dir) shutil.copy(os.path.join(actions_dir, 'sshfs'), cfg.actions_dir)
@ -121,9 +119,10 @@ class TestBackups(unittest.TestCase):
repository = BorgRepository(repo_path) repository = BorgRepository(repo_path)
repository.create_repository() repository.create_repository()
archive_path = "::".join([repo_path, archive_name]) archive_path = "::".join([repo_path, archive_name])
actions.superuser_run( actions.superuser_run('backups', [
'backups', ['create-archive', '--path', archive_path, '--paths', 'create-archive', '--path', archive_path, '--paths',
self.data_directory]) self.data_directory
])
archive = repository.list_archives()[0] archive = repository.list_archives()[0]
self.assertEquals(archive['name'], archive_name) self.assertEquals(archive['name'], archive_name)
@ -174,8 +173,7 @@ class TestBackups(unittest.TestCase):
credentials = self.get_credentials() credentials = self.get_credentials()
ssh_path = test_config.backups_ssh_path ssh_path = test_config.backups_ssh_path
repository = SshBorgRepository(path=ssh_path, repository = SshBorgRepository(path=ssh_path, credentials=credentials,
credentials=credentials,
automount=False) automount=False)
repository.mount() repository.mount()
self.assertTrue(repository.is_mounted) self.assertTrue(repository.is_mounted)
@ -190,8 +188,7 @@ class TestBackups(unittest.TestCase):
credentials = self.get_credentials() credentials = self.get_credentials()
ssh_path = test_config.backups_ssh_path ssh_path = test_config.backups_ssh_path
repository = SshBorgRepository(path=ssh_path, repository = SshBorgRepository(path=ssh_path, credentials=credentials,
credentials=credentials,
automount=False) automount=False)
repository.mount() repository.mount()
self.assertTrue(repository.is_mounted) self.assertTrue(repository.is_mounted)