changeset 317:d4b59f1dc7f1

Fix slave snapshot unpacking unit test.
author cmlenz
date Sat, 26 Nov 2005 15:37:48 +0000
parents 87c9b1e8f086
children c042e2c7048c
files bitten/tests/slave.py
diffstat 1 files changed, 10 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- 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()
Copyright (C) 2012-2017 Edgewall Software