def test_backup_02(self): """ Backup -> validate backup structure (encrypted) """ bck_params = BackupParameters() bck_params.encryption_key = "encrypt me hard!" expected_extensions = ['tar.bz2.gpg', 'sqlite.gpg', 'yml'] with tempfile.NamedTemporaryFile() as db_filename: with tempfile.TemporaryDirectory() as destination_dir: with tempfile.TemporaryDirectory() as source_dir: bck_params.database_location = db_filename.name bck_params.source = source_dir bck_params.destination = destination_dir # Every archive will be one(1) disc. bck_params.single_archive_size = 1050 bck_params.disc_size = bck_params.single_archive_size src_file_list = self.create_sourceStructure( source_dir, [10, 10]) ctrl = BackupController(GeneralSettings()) # Preparations complete start backup... ctrl.execute(bck_params) # ... backup ended. for subdir, dirs, files in os.walk(destination_dir): for file in files: ok = False for ext in expected_extensions: if file.endswith(ext): ok = True break assert ok, "Found file that was not expected <%s>" % file
def test_full_backup_02(self): """ Backup (with many fragmented files, encrypted) -> Restore -> check result """ bck_params = BackupParameters() # Every archive will be one(1) disc. bck_params.single_archive_size = 300 # this ensures that each file will have multiple archives bck_params.disc_size = bck_params.single_archive_size bck_params.encryption_key = "my awesome encryption key!&" self.do_backup_for_configuration(bck_params)