Exemple #1
0
 def test_patch(self):
     """Test patching file."""
     old_path = '/tmp/1234'
     backend = PosixBackendArchive('/tmp')
     my_file = backend.open('1234', 'w')
     my_file.close()
     backend.patch('5678', '/tmp/1234')
     # Error would be thrown on patch so nothing to assert
     self.assertEqual(old_path, '/tmp/1234')
 def test_patch_failed(self, mock_move):
     """Test patching file."""
     mock_move.side_effect = OSError('Unable to move')
     backend = PosixBackendArchive('/tmp')
     my_file = backend.open('1234', 'w')
     my_file.close()
     with self.assertRaises(ArchiveInterfaceError) as exc:
         backend.patch('5678', '/tmp/1234')
     self.assertTrue(
         'Can\'t move posix file with error' in str(exc.exception))