Mercurial > treepkg
diff test/test_info_data.py @ 416:4980f8d5014a treepkg-status
first version of incremental copying debian packages to cachedir
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Mon, 26 Jul 2010 10:12:40 +0000 |
parents | e0539b483b04 |
children | c8268d40d35d |
line wrap: on
line diff
--- a/test/test_info_data.py Mon Jul 26 09:42:07 2010 +0000 +++ b/test/test_info_data.py Mon Jul 26 10:12:40 2010 +0000 @@ -31,9 +31,18 @@ dbfile = os.path.join(tmpdir, "cachedb2") db = CacheDb(dbfile) + # insert + filename = package.filename db.add_package(package) + package = db.get_package(filename) + self.assertEquals("1234567", package.md5sum) + # update + package.md5sum = "01234567" + db.add_package(package) + package = db.get_package(filename) + self.assertEquals("01234567", package.md5sum) - # test get_package and get_timestamp + # test get_package package2 = db.get_package(package.filename) self.assertNotEquals(None, package2) self.assertEquals(package.filename, package2.filename) @@ -42,16 +51,21 @@ self.assertEquals(package.arch, package2.arch) self.assertEquals(package.md5sum, package2.md5sum) - # test get_old_packages package3 = Package("/tmp/foo/foo_0.2.i386.deb", "foo", - "foo_0.2_i386.deb", "/tmp/foo/foo_0.2.i386.deb", + "foo_0.2_i386.deb", "/tmp/source/foo/foo_0.2.i386.deb", "binary-i386", "987654321") + package4 = Package("/tmp/john/doe_0.3.i386.deb", "john", + "doe_0.3.i386.deb", "/tmp/source/john/doe_0.3.i386.deb", + "binary-i386", "5671234") db.add_package(package3) + db.add_package(package4) + + # test get_old_packages oldpackages = db.get_old_packages([package.filename]) - self.assertEquals(1, len(oldpackages)) + self.assertEquals(2, len(oldpackages)) packages = db.get_packages() - self.assertEquals(2, len(packages)) - db.remove_packages([package.filename for package in oldpackages]) + self.assertEquals(3, len(packages)) + db.remove_packages(oldpackages) packages = db.get_packages() self.assertEquals(1, len(packages))