Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a06ecb-456a-71c2-b41e-0755d336e883
21 lines
971 B
Python
21 lines
971 B
Python
import importlib.util
|
|
from pathlib import Path
|
|
import tempfile
|
|
import unittest
|
|
from unittest.mock import patch
|
|
import sys
|
|
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'scripts'))
|
|
import verify_nextcloud_offsite_restore as transfer
|
|
import restore_forgejo_offsite_locally as restore
|
|
|
|
class RestoreBoundary(unittest.TestCase):
|
|
def test_missing_backup_never_fetches_credentials(self):
|
|
with tempfile.TemporaryDirectory() as d, patch.object(transfer,'bao') as bao:
|
|
with self.assertRaises(transfer.LaneError): transfer.run(Path(d)/'absent.zip.age',Path(d)/'stage',{})
|
|
bao.assert_not_called()
|
|
|
|
def test_truncated_backup_never_starts_docker(self):
|
|
with tempfile.TemporaryDirectory() as d, patch.object(restore.subprocess,'run') as command:
|
|
p=Path(d)/'fetched.zip';p.write_bytes(b'PK\x03\x04truncated')
|
|
with self.assertRaises(Exception): restore.run(p,{})
|
|
command.assert_not_called()
|