merge tests from trunk (we're using this database now)
This commit is contained in:
+211
-28
@@ -12,6 +12,9 @@ import unittest
|
|||||||
import zipfile
|
import zipfile
|
||||||
import shutil
|
import shutil
|
||||||
import os
|
import os
|
||||||
|
import pwd
|
||||||
|
import grp
|
||||||
|
import time
|
||||||
|
|
||||||
import testcase
|
import testcase
|
||||||
|
|
||||||
@@ -25,7 +28,7 @@ class ActionsAPITestCase(testcase.TestCase):
|
|||||||
return
|
return
|
||||||
self.f = zipfile.ZipFile("helloworld-0.1-1.pisi", "r")
|
self.f = zipfile.ZipFile("helloworld-0.1-1.pisi", "r")
|
||||||
self.filelist = []
|
self.filelist = []
|
||||||
|
|
||||||
for file in self.f.namelist():
|
for file in self.f.namelist():
|
||||||
self.filelist.append(file)
|
self.filelist.append(file)
|
||||||
|
|
||||||
@@ -53,7 +56,7 @@ class ActionsAPITestCase(testcase.TestCase):
|
|||||||
"install/var/goodbye", \
|
"install/var/goodbye", \
|
||||||
"install/var/hello", \
|
"install/var/hello", \
|
||||||
"metadata.xml"]
|
"metadata.xml"]
|
||||||
|
|
||||||
'''check number of files in package'''
|
'''check number of files in package'''
|
||||||
self.assertEqual(fileContent.__len__(), self.filelist.__len__())
|
self.assertEqual(fileContent.__len__(), self.filelist.__len__())
|
||||||
|
|
||||||
@@ -61,6 +64,139 @@ class ActionsAPITestCase(testcase.TestCase):
|
|||||||
for file in self.filelist:
|
for file in self.filelist:
|
||||||
self.assert_(fileContent.__contains__(file))
|
self.assert_(fileContent.__contains__(file))
|
||||||
|
|
||||||
|
def testShelltoolsCanAccessFile(self):
|
||||||
|
from pisi.actionsapi.shelltools import can_access_file
|
||||||
|
|
||||||
|
self.assert_(can_access_file('tests/actionsapitests/file'))
|
||||||
|
self.assert_(not can_access_file('tests/actionsapitests/fileX'))
|
||||||
|
self.assert_(can_access_file('tests/actionsapitests/linktoafile'))
|
||||||
|
|
||||||
|
def testShelltoolsCanAccessDir(self):
|
||||||
|
from pisi.actionsapi.shelltools import can_access_directory
|
||||||
|
|
||||||
|
self.assert_(can_access_directory('tests/actionsapitests/adirectory'))
|
||||||
|
self.assert_(not can_access_directory('tests/actionsapitests/adirectoryX'))
|
||||||
|
self.assert_(can_access_directory('tests/actionsapitests/linktoadirectory'))
|
||||||
|
|
||||||
|
def testShelltoolsMakedirs(self):
|
||||||
|
from pisi.actionsapi.shelltools import makedirs
|
||||||
|
|
||||||
|
makedirs('tests/actionsapitests/testdirectory/into/a/directory')
|
||||||
|
self.assertEqual(os.path.exists('tests/actionsapitests/testdirectory/into/a/directory'), True)
|
||||||
|
shutil.rmtree('tests/actionsapitests/testdirectory')
|
||||||
|
|
||||||
|
def testShelltoolsEcho(self):
|
||||||
|
from pisi.actionsapi.shelltools import echo
|
||||||
|
|
||||||
|
echo('tests/actionsapitests/echo-file', 'hububat fiyatları')
|
||||||
|
self.assertEqual(os.path.exists('tests/actionsapitests/echo-file'), True)
|
||||||
|
self.assertEqual(open('tests/actionsapitests/echo-file').readlines()[0].strip(), "hububat fiyatları")
|
||||||
|
echo('tests/actionsapitests/echo-file', 'fiyat hububatları')
|
||||||
|
self.assertEqual(open('tests/actionsapitests/echo-file').readlines()[1].strip(), "fiyat hububatları")
|
||||||
|
os.remove('tests/actionsapitests/echo-file')
|
||||||
|
|
||||||
|
def testShelltoolsChmod(self):
|
||||||
|
from pisi.actionsapi.shelltools import chmod
|
||||||
|
|
||||||
|
chmod('tests/actionsapitests/file')
|
||||||
|
self.assertEqual(oct(os.stat('tests/actionsapitests/file').st_mode)[-3:], '755')
|
||||||
|
chmod('tests/actionsapitests/file', 0644)
|
||||||
|
self.assertEqual(oct(os.stat('tests/actionsapitests/file').st_mode)[-3:], '644')
|
||||||
|
|
||||||
|
def testShelltoolsChown(self):
|
||||||
|
from pisi.actionsapi.shelltools import chown
|
||||||
|
|
||||||
|
f = open('tests/actionsapitests/chowntest', 'w')
|
||||||
|
f.close()
|
||||||
|
chown('tests/actionsapitests/chowntest')
|
||||||
|
self.assertEqual(os.stat('tests/actionsapitests/chowntest').st_uid, pwd.getpwnam('root')[2])
|
||||||
|
self.assertEqual(os.stat('tests/actionsapitests/chowntest').st_gid, grp.getgrnam('root')[2])
|
||||||
|
chown('tests/actionsapitests/chowntest', 'daemon', 'wheel')
|
||||||
|
self.assertEqual(os.stat('tests/actionsapitests/chowntest').st_uid, pwd.getpwnam('daemon')[2])
|
||||||
|
self.assertEqual(os.stat('tests/actionsapitests/chowntest').st_gid, grp.getgrnam('wheel')[2])
|
||||||
|
os.remove('tests/actionsapitests/chowntest')
|
||||||
|
|
||||||
|
def testShelltoolsSym(self):
|
||||||
|
from pisi.actionsapi.shelltools import sym
|
||||||
|
|
||||||
|
sym('tests/actionsapitests/file', 'tests/actionsapitests/filelnk')
|
||||||
|
self.assert_(os.path.islink('tests/actionsapitests/filelnk'))
|
||||||
|
self.assertEqual(os.readlink('tests/actionsapitests/filelnk'), 'tests/actionsapitests/file')
|
||||||
|
os.remove('tests/actionsapitests/filelnk')
|
||||||
|
|
||||||
|
def testShelltoolsUnlink(self):
|
||||||
|
from pisi.actionsapi.shelltools import unlink
|
||||||
|
|
||||||
|
f = open('tests/actionsapitests/unlinktest', 'w')
|
||||||
|
f.close()
|
||||||
|
os.symlink('tests/actionsapitests/unlinktest', 'tests/actionsapitests/unlinktest-sym')
|
||||||
|
unlink('tests/actionsapitests/unlinktest')
|
||||||
|
self.assert_(not os.path.exists('tests/actionsapitests/unlinktest'))
|
||||||
|
|
||||||
|
unlink('tests/actionsapitests/unlinktest-sym')
|
||||||
|
self.assert_(not os.path.exists('tests/actionsapitests/unlinktest-sym'))
|
||||||
|
|
||||||
|
def testShelltoolsUnlinkDir(self):
|
||||||
|
from pisi.actionsapi.shelltools import unlinkDir
|
||||||
|
|
||||||
|
os.mkdir('tests/actionsapitests/unlinkdir')
|
||||||
|
f = open('tests/actionsapitests/unlinkdir/unlinktest', 'w')
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
#FIXME: unlinkDir cannot unlink a link to a directory.
|
||||||
|
#Instead it deletes content of linked directory, then leaves directory and link
|
||||||
|
#unlinkDir('tests/actionsapitests/linktoadirectory')
|
||||||
|
#self.assert_(not os.path.exists('tests/actionsapitests/linktoadirectory'))
|
||||||
|
#os.symlink('tests/actionsapitests/linkeddir', 'tests/actionsapitests/linktoadirectory')
|
||||||
|
|
||||||
|
unlinkDir('tests/actionsapitests/unlinkdir')
|
||||||
|
self.assert_(not os.path.exists('tests/actionsapitests/unlinkdir'))
|
||||||
|
|
||||||
|
def testShelltoolsMove(self):
|
||||||
|
from pisi.actionsapi.shelltools import move
|
||||||
|
|
||||||
|
move('tests/actionsapitests/brokenlink', 'tests/actionsapitests/brokenlink-move')
|
||||||
|
self.assert_(os.path.islink('tests/actionsapitests/brokenlink-move'))
|
||||||
|
self.assertEqual(os.readlink('tests/actionsapitests/brokenlink-move'), '/no/such/place')
|
||||||
|
self.assert_(not os.path.exists('tests/actionsapitests/brokenlink'))
|
||||||
|
shutil.move('tests/actionsapitests/brokenlink-move', 'tests/actionsapitests/brokenlink')
|
||||||
|
|
||||||
|
move('tests/actionsapitests/brokenlink', 'tests/actionsapitests/adirectory/brokenlink-move')
|
||||||
|
self.assert_(os.path.islink('tests/actionsapitests/adirectory/brokenlink-move'))
|
||||||
|
self.assertEqual(os.readlink('tests/actionsapitests/adirectory/brokenlink-move'), '/no/such/place')
|
||||||
|
self.assert_(not os.path.exists('tests/actionsapitests/brokenlink'))
|
||||||
|
shutil.move('tests/actionsapitests/adirectory/brokenlink-move', 'tests/actionsapitests/brokenlink')
|
||||||
|
|
||||||
|
move('tests/actionsapitests/file', 'tests/actionsapitests/adirectory')
|
||||||
|
self.assert_(os.path.isfile('tests/actionsapitests/adirectory/file'))
|
||||||
|
self.assertEqual(os.path.getsize('tests/actionsapitests/adirectory/file'), 321)
|
||||||
|
self.assert_(not os.path.exists('tests/actionsapitests/file'))
|
||||||
|
shutil.move('tests/actionsapitests/adirectory/file', 'tests/actionsapitests/')
|
||||||
|
|
||||||
|
move('tests/actionsapitests/file', 'tests/actionsapitests/file-move')
|
||||||
|
self.assert_(os.path.isfile('tests/actionsapitests/file-move'))
|
||||||
|
self.assertEqual(os.path.getsize('tests/actionsapitests/file-move'), 321)
|
||||||
|
self.assert_(not os.path.exists('tests/actionsapitests/file'))
|
||||||
|
shutil.move('tests/actionsapitests/file-move', 'tests/actionsapitests/file')
|
||||||
|
|
||||||
|
move('tests/actionsapitests/file', 'tests/actionsapitests/adirectory/filewithanothername')
|
||||||
|
self.assert_(os.path.exists('tests/actionsapitests/adirectory/filewithanothername'))
|
||||||
|
self.assertEqual(os.path.getsize('tests/actionsapitests/adirectory/filewithanothername'), 321)
|
||||||
|
self.assert_(not os.path.exists('tests/actionsapitests/file'))
|
||||||
|
shutil.move('tests/actionsapitests/adirectory/filewithanothername', 'tests/actionsapitests/file')
|
||||||
|
|
||||||
|
#FIXME: this type of moving (without changing name) doesn't work
|
||||||
|
#And I'm not sure the right way is to use 'tests/actionsapitests/adirectory/linkeddir' as dest.
|
||||||
|
#move('tests/actionsapitests/linkeddir', 'tests/actionsapitests/adirectory')
|
||||||
|
#self.assert_(os.path.exists('tests/actionsapitests/adirectory/linkeddir/file'))
|
||||||
|
#self.assertEqual(os.path.getsize('tests/actionsapitests/adirectory/linkeddir/file'), 321)
|
||||||
|
#shutil.move('tests/actionsapitests/adirectory/linkeddir', 'tests/actionsapitests/linkeddir')
|
||||||
|
|
||||||
|
move('tests/actionsapitests/linkeddir', 'tests/actionsapitests/adirectory/withanothername')
|
||||||
|
self.assert_(os.path.exists('tests/actionsapitests/adirectory/withanothername/file'))
|
||||||
|
self.assertEqual(os.path.getsize('tests/actionsapitests/adirectory/withanothername/file'), 321)
|
||||||
|
shutil.move('tests/actionsapitests/adirectory/withanothername', 'tests/actionsapitests/linkeddir')
|
||||||
|
|
||||||
def testShelltoolsCopy(self):
|
def testShelltoolsCopy(self):
|
||||||
from pisi.actionsapi.shelltools import copy
|
from pisi.actionsapi.shelltools import copy
|
||||||
|
|
||||||
@@ -109,38 +245,87 @@ class ActionsAPITestCase(testcase.TestCase):
|
|||||||
self.assertEqual(os.path.exists('tests/actionsapitests/adirectory/withanothername/file'), True)
|
self.assertEqual(os.path.exists('tests/actionsapitests/adirectory/withanothername/file'), True)
|
||||||
shutil.rmtree('tests/actionsapitests/adirectory/withanothername')
|
shutil.rmtree('tests/actionsapitests/adirectory/withanothername')
|
||||||
|
|
||||||
def testShelltoolsCanAccessFile(self):
|
def testShelltoolsCopyTree(self):
|
||||||
from pisi.actionsapi.shelltools import can_access_file
|
from pisi.actionsapi.shelltools import copytree
|
||||||
|
|
||||||
self.assert_(can_access_file('tests/actionsapitests/file'))
|
copytree('tests/actionsapitests/linkeddir', 'tests/actionsapitests/adirectory')
|
||||||
self.assert_(not can_access_file('tests/actionsapitests/fileX'))
|
self.assert_(os.path.exists('tests/actionsapitests/linkeddir/file'))
|
||||||
self.assert_(can_access_file('tests/actionsapitests/linktoafile'))
|
self.assertEqual(os.path.getsize('tests/actionsapitests/linkeddir/file'), 321)
|
||||||
|
self.assert_(os.path.exists('tests/actionsapitests/adirectory/linkeddir/file'))
|
||||||
|
self.assertEqual(os.path.getsize('tests/actionsapitests/adirectory/linkeddir/file'), 321)
|
||||||
|
shutil.rmtree('tests/actionsapitests/adirectory/linkeddir')
|
||||||
|
|
||||||
def testShelltoolsCanAccessDir(self):
|
copytree('tests/actionsapitests/linkeddir', 'tests/actionsapitests/adirectory/withanothername')
|
||||||
from pisi.actionsapi.shelltools import can_access_directory
|
self.assert_(os.path.exists('tests/actionsapitests/linkeddir/file'))
|
||||||
|
self.assertEqual(os.path.getsize('tests/actionsapitests/linkeddir/file'), 321)
|
||||||
|
self.assert_(os.path.exists('tests/actionsapitests/adirectory/withanothername/file'))
|
||||||
|
self.assertEqual(os.path.getsize('tests/actionsapitests/adirectory/withanothername/file'), 321)
|
||||||
|
shutil.rmtree('tests/actionsapitests/adirectory/withanothername')
|
||||||
|
|
||||||
self.assert_(can_access_directory('tests/actionsapitests/adirectory'))
|
def testShelltoolsTouch(self):
|
||||||
self.assert_(not can_access_directory('tests/actionsapitests/adirectoryX'))
|
from pisi.actionsapi.shelltools import touch
|
||||||
self.assert_(can_access_directory('tests/actionsapitests/linktoadirectory'))
|
|
||||||
|
|
||||||
|
touch('tests/actionsapitests/file-touch')
|
||||||
def testShelltoolsMakedirs(self):
|
self.assert_(os.path.exists('tests/actionsapitests/file-touch'))
|
||||||
from pisi.actionsapi.shelltools import makedirs
|
os.remove('tests/actionsapitests/file-touch')
|
||||||
|
|
||||||
makedirs('tests/actionsapitests/testdirectory/into/a/directory')
|
atime = int(time.time())
|
||||||
self.assertEqual(os.path.exists('tests/actionsapitests/testdirectory/into/a/directory'), True)
|
touch('tests/actionsapitests/file')
|
||||||
shutil.rmtree('tests/actionsapitests/testdirectory')
|
self.assertEqual(os.path.getsize('tests/actionsapitests/file'), 321)
|
||||||
|
self.assert_(atime <= os.stat('tests/actionsapitests/file').st_atime)
|
||||||
|
|
||||||
def testShelltoolsEcho(self):
|
def testShelltoolsCd(self):
|
||||||
from pisi.actionsapi.shelltools import echo
|
from pisi.actionsapi.shelltools import cd
|
||||||
|
|
||||||
echo('tests/actionsapitests/echo-file', 'hububat fiyatları')
|
current = os.getcwd()
|
||||||
self.assertEqual(os.path.exists('tests/actionsapitests/echo-file'), True)
|
cd('tests/actionsapitests')
|
||||||
self.assertEqual(open('tests/actionsapitests/echo-file').readlines()[0].strip(), "hububat fiyatları")
|
self.assertEqual(os.path.getsize('file'), 321)
|
||||||
echo('tests/actionsapitests/echo-file', 'fiyat hububatları')
|
cd()
|
||||||
self.assertEqual(open('tests/actionsapitests/echo-file').readlines()[1].strip(), "fiyat hububatları")
|
self.assertEqual(os.path.getsize('actionsapitests/file'), 321)
|
||||||
os.remove('tests/actionsapitests/echo-file')
|
os.chdir(current)
|
||||||
|
|
||||||
|
def testShelltoolsLs(self):
|
||||||
|
from pisi.actionsapi.shelltools import ls
|
||||||
|
|
||||||
|
self.assertEqual(os.listdir('tests/actionsapitests'), ls('tests/actionsapitests'))
|
||||||
|
|
||||||
|
self.assertEqual(os.listdir('tests/actionsapitests/linkeddir'), ls('tests/actionsapitests/linktoadirectory'))
|
||||||
|
|
||||||
|
self.assertEqual(['tests/actionsapitests/file'], ls('tests/actionsapitests/f*'))
|
||||||
|
|
||||||
|
def testShelltoolsExport(self):
|
||||||
|
from pisi.actionsapi.shelltools import export
|
||||||
|
|
||||||
|
export('hububat', 'fiyatları')
|
||||||
|
self.assertEqual(os.environ['hububat'], 'fiyatları')
|
||||||
|
del(os.environ['hububat'])
|
||||||
|
|
||||||
|
def testShelltoolsIsLink(self):
|
||||||
|
from pisi.actionsapi.shelltools import isLink
|
||||||
|
|
||||||
|
self.assert_(isLink('tests/actionsapitests/linktoadirectory'))
|
||||||
|
self.assert_(isLink('tests/actionsapitests/linktoafile'))
|
||||||
|
self.assert_(isLink('tests/actionsapitests/brokenlink'))
|
||||||
|
self.assert_(not isLink('tests/actionsapitests/file'))
|
||||||
|
self.assert_(not isLink('tests/actionsapitests/adirectory'))
|
||||||
|
|
||||||
|
def testShelltoolsIsFile(self):
|
||||||
|
from pisi.actionsapi.shelltools import isFile
|
||||||
|
|
||||||
|
self.assert_(not isFile('tests/actionsapitests/linktoadirectory'))
|
||||||
|
self.assert_(not isFile('tests/actionsapitests/linktoafile'))
|
||||||
|
self.assert_(not isFile('tests/actionsapitests/brokenlink'))
|
||||||
|
self.assert_(isFile('tests/actionsapitests/file'))
|
||||||
|
self.assert_(not isFile('tests/actionsapitests/adirectory'))
|
||||||
|
|
||||||
|
def testShelltoolsIsDirectory(self):
|
||||||
|
from pisi.actionsapi.shelltools import isDirectory
|
||||||
|
|
||||||
|
self.assert_(not isDirectory('tests/actionsapitests/linktoadirectory'))
|
||||||
|
self.assert_(not isDirectory('tests/actionsapitests/linktoafile'))
|
||||||
|
self.assert_(not isDirectory('tests/actionsapitests/brokenlink'))
|
||||||
|
self.assert_(not isDirectory('tests/actionsapitests/file'))
|
||||||
|
self.assert_(isDirectory('tests/actionsapitests/adirectory'))
|
||||||
|
|
||||||
def testShelltoolsSystem(self):
|
def testShelltoolsSystem(self):
|
||||||
from pisi.actionsapi.shelltools import system as s
|
from pisi.actionsapi.shelltools import system as s
|
||||||
@@ -150,6 +335,4 @@ class ActionsAPITestCase(testcase.TestCase):
|
|||||||
self.assertEqual(os.path.exists('tests/actionsapitests/systest'), True)
|
self.assertEqual(os.path.exists('tests/actionsapitests/systest'), True)
|
||||||
os.remove('tests/actionsapitests/systest')
|
os.remove('tests/actionsapitests/systest')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
suite = unittest.makeSuite(ActionsAPITestCase)
|
suite = unittest.makeSuite(ActionsAPITestCase)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class ConfigFileTestCase(unittest.TestCase):
|
|||||||
self.assertEqual(cf.dirs.archives_dir, "/disk2/pisi/archives")
|
self.assertEqual(cf.dirs.archives_dir, "/disk2/pisi/archives")
|
||||||
|
|
||||||
# test default values
|
# test default values
|
||||||
self.assertEqual(cf.dirs.tmp_dir, "/var/tmp/pisi")
|
self.assertEqual(cf.dirs.tmp_dir, "/var/pisi")
|
||||||
|
|
||||||
def testAccessMethods(self):
|
def testAccessMethods(self):
|
||||||
cf = self.cf
|
cf = self.cf
|
||||||
|
|||||||
@@ -20,16 +20,16 @@ WorkDir = "hello-1.3"
|
|||||||
|
|
||||||
def setup():
|
def setup():
|
||||||
autotools.configure()
|
autotools.configure()
|
||||||
|
|
||||||
def build():
|
def build():
|
||||||
autotools.make()
|
autotools.make()
|
||||||
|
|
||||||
def install():
|
def install():
|
||||||
autotools.install()
|
autotools.install()
|
||||||
|
|
||||||
'''/opt/helloworld/'''
|
'''/opt/helloworld/'''
|
||||||
pisitools.dodir("/opt/helloworld")
|
pisitools.dodir("/opt/helloworld")
|
||||||
|
|
||||||
'''/usr/share/doc/helloworld-0.1-1/Makefile.am'''
|
'''/usr/share/doc/helloworld-0.1-1/Makefile.am'''
|
||||||
pisitools.dodoc("Makefile.am")
|
pisitools.dodoc("Makefile.am")
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ def install():
|
|||||||
pisitools.dobin("src/helloworld")
|
pisitools.dobin("src/helloworld")
|
||||||
'''/bin/helloworld'''
|
'''/bin/helloworld'''
|
||||||
pisitools.dobin("src/helloworld", "/bin")
|
pisitools.dobin("src/helloworld", "/bin")
|
||||||
|
|
||||||
'''/usr/sbin/helloworld'''
|
'''/usr/sbin/helloworld'''
|
||||||
pisitools.dosbin("src/helloworld")
|
pisitools.dosbin("src/helloworld")
|
||||||
'''/sbin/helloworld'''
|
'''/sbin/helloworld'''
|
||||||
@@ -97,6 +97,6 @@ def install():
|
|||||||
shelltools.unlink("%s/sys/helloworld/helloworld" % get.installDIR())
|
shelltools.unlink("%s/sys/helloworld/helloworld" % get.installDIR())
|
||||||
'''delete /sys/helloworld'''
|
'''delete /sys/helloworld'''
|
||||||
shelltools.unlinkDir("%s/sys/helloworld" % get.installDIR())
|
shelltools.unlinkDir("%s/sys/helloworld" % get.installDIR())
|
||||||
|
|
||||||
'''generate /usr/lib/helloworld.o'''
|
'''generate /usr/lib/helloworld.o'''
|
||||||
libtools.gen_usr_ldscript("helloworld.o")
|
libtools.gen_usr_ldscript("helloworld.o")
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<PartOf>component</PartOf>
|
<PartOf>component</PartOf>
|
||||||
<Summary xml:lang="en">Dummy HelloWorld for testing ActionsAPI</Summary>
|
<Summary xml:lang="en">Dummy HelloWorld for testing ActionsAPI</Summary>
|
||||||
<Description xml:lang="en">Dummy HelloWorld for testing ActionsAPI</Description>
|
<Description xml:lang="en">Dummy HelloWorld for testing ActionsAPI</Description>
|
||||||
<Archive type="targz" sha1sum="c8927baab2aae5fb4d1243067ca5244e3120f2ff">http://cekirdek.uludag.org.tr/~eray/hello-1.3.tar.gz</Archive>
|
<Archive type="targz" sha1sum="c8927baab2aae5fb4d1243067ca5244e3120f2ff">http://ftp.club.cc.cmu.edu/pub/gnu/hello/hello-1.3.tar.gz</Archive>
|
||||||
</Source>
|
</Source>
|
||||||
|
|
||||||
<Package>
|
<Package>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class PackageTestCase(testcase.TestCase):
|
|||||||
testdir = os.path.join(cur, "tests/popt")
|
testdir = os.path.join(cur, "tests/popt")
|
||||||
|
|
||||||
pkg_path = os.path.join(tmpdir, self.pkgName)
|
pkg_path = os.path.join(tmpdir, self.pkgName)
|
||||||
pkg = package.Package(pkg_path, "w")
|
pkg = pisi.package.Package(pkg_path, "w")
|
||||||
|
|
||||||
os.chdir(testdir)
|
os.chdir(testdir)
|
||||||
pkg.add_to_package("files.xml")
|
pkg.add_to_package("files.xml")
|
||||||
@@ -39,7 +39,7 @@ class PackageTestCase(testcase.TestCase):
|
|||||||
|
|
||||||
pkg.close()
|
pkg.close()
|
||||||
|
|
||||||
pkg = package.Package(pkg_path)
|
pkg = pisi.package.Package(pkg_path)
|
||||||
pkg.extract_file("files.xml", cur)
|
pkg.extract_file("files.xml", cur)
|
||||||
if not os.path.exists("files.xml"):
|
if not os.path.exists("files.xml"):
|
||||||
self.fail("Package extract error")
|
self.fail("Package extract error")
|
||||||
|
|||||||
+5
-14
@@ -19,13 +19,13 @@ class SpecFileNewTestCase(unittest.TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.spec = specfile.SpecFile()
|
self.spec = specfile.SpecFile()
|
||||||
self.spec.read("tests/popt/pspec.xml")
|
self.spec.read("tests/popt/pspec.xml")
|
||||||
|
|
||||||
def testFields(self):
|
def testFields(self):
|
||||||
self.assertEqual(self.spec.source.name, "popt")
|
self.assertEqual(self.spec.source.name, "popt")
|
||||||
|
|
||||||
self.assertEqual(self.spec.source.version, "1.7")
|
self.assertEqual(self.spec.getSourceVersion(), "1.7")
|
||||||
|
|
||||||
self.assertEqual(self.spec.source.release, "1")
|
self.assertEqual(self.spec.getSourceRelease(), "1")
|
||||||
|
|
||||||
self.assertEqual(self.spec.source.archive.sha1sum,
|
self.assertEqual(self.spec.source.archive.sha1sum,
|
||||||
"66f3c77b87a160951b180447f4a6dce68ad2f71b")
|
"66f3c77b87a160951b180447f4a6dce68ad2f71b")
|
||||||
@@ -49,24 +49,15 @@ class SpecFileNewTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
def testIsAPartOf(self):
|
def testIsAPartOf(self):
|
||||||
# test existence in Source
|
# test existence in Source
|
||||||
|
|
||||||
if not "app:console" in self.spec.source.isA:
|
if not "app:console" in self.spec.source.isA:
|
||||||
self.fail("Failed to match IsA in Source")
|
self.fail("Failed to match IsA in Source")
|
||||||
if not isinstance(self.spec.source.isA, list):
|
if not isinstance(self.spec.source.isA, list):
|
||||||
self.fail("source.isA is not a list, but it must be...")
|
self.fail("source.isA is not a list, but it must be...")
|
||||||
|
|
||||||
if "system.base" != self.spec.source.partOf:
|
if "system.base" != self.spec.source.partOf:
|
||||||
self.fail("Failed to match PartOf in Source")
|
self.fail("Failed to match PartOf in Source")
|
||||||
|
|
||||||
# test existence in Package
|
|
||||||
pkg = self.spec.packages[0]
|
|
||||||
if not "app:console" in pkg.isA:
|
|
||||||
self.fail("Failed to match IsA in Package")
|
|
||||||
if not isinstance(pkg.isA, list):
|
|
||||||
self.fail("source.isA is not a list, but it must be...")
|
|
||||||
|
|
||||||
if "system.base" != pkg.partOf:
|
|
||||||
self.fail("Failed to match PartOf in Package")
|
|
||||||
|
|
||||||
def testVerify(self):
|
def testVerify(self):
|
||||||
if self.spec.errors():
|
if self.spec.errors():
|
||||||
self.fail("Failed to verify specfile")
|
self.fail("Failed to verify specfile")
|
||||||
|
|||||||
Reference in New Issue
Block a user