From 598edffd2c1c7e671c9128e978fdd2b434fc0b30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beyza=20Ermi=C5=9F?= Date: Thu, 10 Jul 2008 12:59:35 +0000 Subject: [PATCH] File test case has been added. --- tests/filetest.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/filetest.py diff --git a/tests/filetest.py b/tests/filetest.py new file mode 100644 index 00000000..f656226e --- /dev/null +++ b/tests/filetest.py @@ -0,0 +1,44 @@ +import unittest +from pisi.specfile import SpecFile +from pisi import uri +from pisi.file import File + +class FileTestCase(unittest.TestCase): + + def setUp(self): + unittest.TestCase.setUp(self) + + def testMakeUri(self): + self.spec = SpecFile() + self.url = uri.URI(self.spec.source.archive.uri) + f = File('repos/pardus-2007/system/base/curl/pspec.xml', File.read) + self.assert_(f.make_uri('uri')) + + def testChooseMethod(self): + compress = File('repos/contrib-2007/pisi-index.xml.bz2', File.read) + self.assert_(File.choose_method('pisi.conf', compress)) + + def testDecompress(self): + localfile = File('repos/pardus-2007/system/base/curl/pspec.xml', File.read) + compress = File('repos/contrib-2007/pisi-index.xml.bz2', File.read) + self.assert_(File.decompress(localfile,compress)) + + def testLocalFile(self): + f = File('repos/pardus-2007/system/base/curl/pspec.xml', File.read) + r = f.readlines() + assert (len(r) > 0) + + def testIsatty(self): + f = File('repos/pardus-2007/system/base/curl/pspec.xml', File.read) + assert not f.isatty() + + def testFileNo(self): + f = File('repos/pardus-2007/system/base/curl/pspec.xml', File.read) + assert 3 == f.fileno() + + def testRemoteRead(self): + f = File('http://uludag.org.tr/bulten/index.html', File.read) + r = f.readlines() + assert (len(r) > 0) + +