# HG changeset patch # User cmlenz # Date 1133019468 0 # Node ID d4b59f1dc7f12d74ea60fb9cb3b2ba3bf433f631 # Parent 87c9b1e8f0860e32393fc8d430ecdedc63cd2257 Fix slave snapshot unpacking unit test. diff --git a/bitten/tests/slave.py b/bitten/tests/slave.py --- a/bitten/tests/slave.py +++ b/bitten/tests/slave.py @@ -34,33 +34,18 @@ fd.close() return filename - def test_unpack_invalid_zip_1(self): - """ - Verify handling of `IOError` exceptions when trying to unpack an - invalid ZIP file. - - The `zipfile` module will actually raise an `IOError` instead of a - `zipfile.error` here because it'll try to seek past the beginning of - the file. + def test_unpack_invalid_snapshot(self): """ - path = self._create_file('invalid.zip') - zip = file(path, 'w') - zip.write('INVALID') - zip.close() - self.assertRaises(beep.ProtocolError, self.handler.unpack_snapshot, 0, - os.path.dirname(path), 'invalid.zip') - - def test_unpack_invalid_zip_2(self): + Verify handling of `TarError` exceptions when trying to unpack an + invalid .tar.bz2 file. """ - Verify handling of `zip.error` exceptions when trying to unpack an - invalid ZIP file. - """ - path = self._create_file('invalid.zip') - zip = file(path, 'w') - zip.write('INVALIDINVALIDINVALIDINVALIDINVALIDINVALID') - zip.close() - self.assertRaises(beep.ProtocolError, self.handler.unpack_snapshot, 0, - os.path.dirname(path), 'invalid.zip') + path = self._create_file('invalid.tar.bz2') + tarbz2 = file(path, 'w') + tarbz2.write('INVALID') + tarbz2.close() + self.assertRaises(beep.ProtocolError, self.handler.unpack_snapshot, + os.path.dirname(path), 'invalid.tar.bz2') + def suite(): suite = unittest.TestSuite()