diff --git a/tests/fetchertests.py b/tests/fetchertests.py index ba3efa09..fe07b2b0 100644 --- a/tests/fetchertests.py +++ b/tests/fetchertests.py @@ -5,17 +5,21 @@ import os from pisi import fetcher from pisi import util from pisi import context +from pisi import config +from pisi import purl class FetcherTestCase(unittest.TestCase): def setUp(self): self.ctx = context.BuildContext("samples/popt/popt.pspec") - self.fetch = fetcher.Fetcher(self.ctx.spec.source) + self.url = purl.PUrl(self.ctx.spec.source.archiveUri) + self.destpath = config.config.archives_dir() + self.fetch = fetcher.Fetcher(self.url, self.destpath) def testFetch(self): self.fetch.fetch() - destpath = self.fetch.filedest + "/" + self.fetch.filename - if os.access(destpath, os.R_OK): - self.assertEqual(util.sha1_file(destpath), + fetchedFile = os.path.join(self.destpath, self.url.filename()) + if os.access(fetchedFile, os.R_OK): + self.assertEqual(util.sha1_file(fetchedFile), self.ctx.spec.source.archiveSHA1) suite = unittest.makeSuite(FetcherTestCase)