[tests] add tagged packages match test

This commit is contained in:
Fabio Erculiani
2010-01-28 13:13:00 +01:00
parent 25a0134db0
commit b58be877a4
3 changed files with 27 additions and 0 deletions

View File

@@ -55,6 +55,13 @@ def get_test_entropy_package_provide():
test_pkg = "mail-mta:ssmtp-2.62-r7~0.tbz2"
return get_test_generic_package(test_pkg)
def get_test_entropy_package_tag():
test_pkg = "app-misc:lirc-0.8.6-r2#2.6.31-sabayon~0.tbz2"
return get_test_generic_package(test_pkg)
def get_test_entropy_package_tag_atom():
return "app-misc/lirc-0.8.6-r2#2.6.31-sabayon"
def get_test_xpak_empty_package():
test_pkg = "aspell-es-0.50.2.tbz2"
return get_test_generic_package(test_pkg)

View File

@@ -11,6 +11,8 @@ from entropy.core.settings.base import SystemSettings
from entropy.db import EntropyRepository
import tests._misc as _misc
import entropy.tools
class EntropyRepositoryTest(unittest.TestCase):
def setUp(self):
@@ -328,6 +330,24 @@ class EntropyRepositoryTest(unittest.TestCase):
masking_validation.clear()
self.assertNotEqual((-1, 1), self.test_db.atomMatch(pkg_atom))
def test_db_insert_compare_match_tag(self):
# insert/compare
test_pkg = _misc.get_test_entropy_package_tag()
data = self.Spm.extract_package_metadata(test_pkg)
idpackage, rev, new_data = self.test_db.handlePackage(data)
db_data = self.test_db.getPackageData(idpackage)
self.assertEqual(new_data, db_data)
# match
f_match = (1, 0)
pkg_atom = _misc.get_test_entropy_package_tag_atom()
pkg_key = entropy.tools.dep_getkey(pkg_atom)
self.assertEqual(f_match, self.test_db.atomMatch(pkg_key))
self.assertEqual(f_match, self.test_db.atomMatch(pkg_atom))
self.assertEqual(f_match, self.test_db.atomMatch("~"+pkg_atom))
def test_db_import_export(self):
test_pkg = _misc.get_test_package2()