tests: Add tearDown method for cleanup
This commit is contained in:
@@ -19,20 +19,21 @@ class InstallDBTestCase(testcase.TestCase):
|
||||
testcase.TestCase.setUp(self)
|
||||
self.installdb = pisi.db.installdb.InstallDB()
|
||||
|
||||
def tearDown(self):
|
||||
pisi.api.remove(["ctorrent", "ethtool"])
|
||||
|
||||
def testGetPackage(self):
|
||||
pisi.api.install(["ethtool"])
|
||||
idb = pisi.db.installdb.InstallDB()
|
||||
pkg = idb.get_package("ethtool")
|
||||
assert type(pkg) == pisi.metadata.Package
|
||||
assert pkg.name == "ethtool"
|
||||
pisi.api.remove(["ethtool"])
|
||||
|
||||
def testHasPackage(self):
|
||||
pisi.api.install(["ethtool"])
|
||||
self.installdb = pisi.db.installdb.InstallDB()
|
||||
assert not self.installdb.has_package("hedehodo")
|
||||
assert self.installdb.has_package("ethtool")
|
||||
pisi.api.remove(["ethtool"])
|
||||
|
||||
def testListInstalled(self):
|
||||
pisi.api.install(["ethtool"])
|
||||
@@ -41,7 +42,6 @@ class InstallDBTestCase(testcase.TestCase):
|
||||
'jpeg', 'libidn', 'db4',
|
||||
'cracklib', 'openssl',
|
||||
'curl', 'bash', 'ethtool'])
|
||||
pisi.api.remove(["ethtool"])
|
||||
|
||||
def testGetVersion(self):
|
||||
pisi.api.install(["ethtool"])
|
||||
@@ -50,14 +50,12 @@ class InstallDBTestCase(testcase.TestCase):
|
||||
assert version == "0.3"
|
||||
assert release == "1"
|
||||
assert build == None
|
||||
pisi.api.remove(["ethtool"])
|
||||
|
||||
def testGetFiles(self):
|
||||
pisi.api.install(["ethtool"])
|
||||
self.installdb = pisi.db.installdb.InstallDB()
|
||||
files = self.installdb.get_files("ethtool")
|
||||
assert files.list[0].path == "usr/bin/ethtool"
|
||||
pisi.api.remove(["ethtool"])
|
||||
|
||||
def testGetInfo(self):
|
||||
pisi.api.install(["ethtool"])
|
||||
@@ -65,7 +63,6 @@ class InstallDBTestCase(testcase.TestCase):
|
||||
info = idb.get_info("ethtool")
|
||||
self.assertTrue(isinstance(info, pisi.db.installdb.InstallInfo))
|
||||
self.assertEqual(info.version, "0.3")
|
||||
pisi.api.remove(["ethtool"])
|
||||
|
||||
def testGetReverseDependencies(self):
|
||||
pisi.api.install(["ethtool"])
|
||||
@@ -73,8 +70,6 @@ class InstallDBTestCase(testcase.TestCase):
|
||||
self.installdb = pisi.db.installdb.InstallDB()
|
||||
revdeps = self.installdb.get_rev_deps("openssl")
|
||||
assert set(["ctorrent", "curl"]) == set(map(lambda x:x[0], revdeps))
|
||||
pisi.api.remove(["ctorrent"])
|
||||
pisi.api.remove(["ethtool"])
|
||||
|
||||
def testAddRemovePackage(self):
|
||||
pisi.api.install(["ctorrent"])
|
||||
@@ -85,8 +80,6 @@ class InstallDBTestCase(testcase.TestCase):
|
||||
self.installdb = pisi.db.installdb.InstallDB()
|
||||
assert self.installdb.has_package("ctorrent")
|
||||
assert self.installdb.has_package("ethtool")
|
||||
pisi.api.remove(["ctorrent"])
|
||||
pisi.api.remove(["ethtool"])
|
||||
|
||||
def testMarkListPending(self):
|
||||
pisi.api.set_comar(False)
|
||||
@@ -109,12 +102,9 @@ class InstallDBTestCase(testcase.TestCase):
|
||||
pisi.api.set_comar(True)
|
||||
|
||||
def testSearchPackage(self):
|
||||
pisi.api.set_comar(False)
|
||||
self.installdb = pisi.db.installdb.InstallDB()
|
||||
assert not self.installdb.has_package("ethtool")
|
||||
assert not self.installdb.search_package(["ethtool"])
|
||||
pisi.api.install(["ethtool"])
|
||||
self.installdb = pisi.db.installdb.InstallDB()
|
||||
assert self.installdb.search_package(["et", "tool", "h"]) == ["ethtool"]
|
||||
pisi.api.remove(["ethtool"])
|
||||
pisi.api.set_comar(True)
|
||||
|
||||
Reference in New Issue
Block a user