From b446419792f6c4d68a14ec3f20991b2d6efd7dcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Metin?= Date: Tue, 14 Jun 2005 11:26:55 +0000 Subject: [PATCH] =?UTF-8?q?zip=20dosyalar=C4=B1=20i=C3=A7in=20unittest.=20?= =?UTF-8?q?ARchiveZip=20=C5=9Fu=20anda=20fail=20ediyor.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/unittests/archivetests.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/unittests/archivetests.py b/src/unittests/archivetests.py index 94a270d7..5864eb35 100644 --- a/src/unittests/archivetests.py +++ b/src/unittests/archivetests.py @@ -1,9 +1,11 @@ import unittest from os.path import exists as pathexists +from os.path import basename from pisi import archive from pisi import specfile +from pisi import fetcher from pisi import util class ArchiveFileTestCase(unittest.TestCase): @@ -11,14 +13,14 @@ class ArchiveFileTestCase(unittest.TestCase): self.spec = specfile.SpecFile() self.spec.read("samples/popt.pspec") - self.achv = archive.Archive(self.spec.source.archiveType, - self.spec.source.archiveName) - def testUnpackTar(self): + achv = archive.Archive(self.spec.source.archiveType, + self.spec.source.archiveName) + assert self.spec.source.archiveType == "targz" # unpacking is trivial with Archive() - self.achv.unpack() + achv.unpack() # but testing is hard assert pathexists("popt-1.7") @@ -29,5 +31,16 @@ class ArchiveFileTestCase(unittest.TestCase): self.assertEqual(util.md5_file(testfile), "171545adab7b51ebf6ec5575d3000a95") + def testUnpackZip(self): + # first, we need to fetch a zip file + uri = "http://cekirdek.uludag.org.tr/~meren/sandbox.zip" + filename = basename(uri) + fetch = fetcher.Fetcher(uri, filename) + fetch.fetch() + + achv = archive.Archive("zip", filename) + achv.unpack() + + suite = unittest.makeSuite(ArchiveFileTestCase)