diff --git a/scripts/restore.py b/scripts/restore.py index 2dca3775..4ac091f3 100755 --- a/scripts/restore.py +++ b/scripts/restore.py @@ -74,6 +74,7 @@ class Restore(object): return 1 return ret + class WALERestore(Restore): def __init__(self, scope, role, datadir, connstring, env=None): @@ -133,7 +134,8 @@ class WALERestore(Restore): threshold_backup_size_percentage = self.wal_e.threshold_backup_size_percentage try: - latest_backup = subprocess.check_output(self.wal_e.cmd.split() + ['backup-list', '--detail', 'LATEST'], env=self.env) + latest_backup = subprocess.check_output(self.wal_e.cmd.split() + ['backup-list', '--detail', 'LATEST'], + env=self.env) # name last_modified expanded_size_bytes wal_segment_backup_start wal_segment_offset_backup_start # wal_segment_backup_stop wal_segment_offset_backup_stop # base_00000001000000000000007F_00000040 2015-05-18T10:13:25.000Z diff --git a/tests/test_restore.py b/tests/test_restore.py index cb4f2a83..38b34c6a 100644 --- a/tests/test_restore.py +++ b/tests/test_restore.py @@ -50,7 +50,6 @@ class TestRestore(unittest.TestCase): self.assertEqual(ret, 1) - @patch('os.access', MagicMock(return_value=True)) @patch('os.makedirs', MagicMock(return_value=True)) @patch('os.path.exists', MagicMock(return_value=True)) @@ -76,7 +75,6 @@ class TestWALERestore(unittest.TestCase): self.wale_restore.setup() self.assertFalse(self.wale_restore.init_error) - # have to redefine the class-level os.access mock inside the function # since the class-level mock will be applied after the function level one. @patch('os.access', return_value=False) @@ -85,7 +83,6 @@ class TestWALERestore(unittest.TestCase): self.wale_restore.setup() self.assertTrue(self.wale_restore.init_error) - # The 3 tests above only differ with the mock function instead of a subprocess call # in the first one, subprocess call should return success only for wal-e command, # checking the primary use-case of restoring from WAL-E backup.