mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Misc test fixes for corrupted archive test though not sure what doing ..
This commit is contained in:
parent
037a2a66a4
commit
80e2e0da71
2 changed files with 7 additions and 5 deletions
|
@ -2418,7 +2418,7 @@ def backup_info(name, with_details=False, human_readable=False):
|
|||
|
||||
try:
|
||||
files_in_archive = tar.getnames()
|
||||
except IOError as e:
|
||||
except (IOError, EOFError) as e:
|
||||
raise YunohostError(
|
||||
"backup_archive_corrupted", archive=archive_file, error=str(e)
|
||||
)
|
||||
|
@ -2532,6 +2532,8 @@ def backup_delete(name):
|
|||
files_to_delete.append(actual_archive)
|
||||
|
||||
for backup_file in files_to_delete:
|
||||
if not os.path.exists(backup_file):
|
||||
continue
|
||||
try:
|
||||
os.remove(backup_file)
|
||||
except Exception:
|
||||
|
|
|
@ -640,13 +640,13 @@ def test_restore_archive_with_bad_archive(mocker):
|
|||
|
||||
# Break the archive
|
||||
os.system(
|
||||
"head -n 1000 /home/yunohost.backup/archives/backup_wordpress_from_3p8.tar.gz > /home/yunohost.backup/archives/backup_wordpress_from_3p8.tar.gz"
|
||||
"head -n 1000 /home/yunohost.backup/archives/backup_wordpress_from_3p8.tar.gz > /home/yunohost.backup/archives/backup_wordpress_from_3p8_bad.tar.gz"
|
||||
)
|
||||
|
||||
assert "backup_wordpress_from_3p8" in backup_list()["archives"]
|
||||
assert "backup_wordpress_from_3p8_bad" in backup_list()["archives"]
|
||||
|
||||
with raiseYunohostError(mocker, "backup_archive_open_failed"):
|
||||
backup_restore(name="backup_wordpress_from_3p8", force=True)
|
||||
with raiseYunohostError(mocker, "backup_archive_corrupted"):
|
||||
backup_restore(name="backup_wordpress_from_3p8_bad", force=True)
|
||||
|
||||
clean_tmp_backup_directory()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue