aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJauhien Piatlicki (jauhien) <piatlicki@gmail.com>2013-09-18 22:11:14 +0200
committerJauhien Piatlicki (jauhien) <piatlicki@gmail.com>2013-09-18 22:11:14 +0200
commit18f089354e83eae5c98d998894d0f6ca9dd5f981 (patch)
tree55b1a574eb630e9166a1f0fef29cb5339eb2969c /tests
parentg_sorcery/package_db: fix external dependency convertion (diff)
downloadg-sorcery-18f089354e83eae5c98d998894d0f6ca9dd5f981.tar.gz
g-sorcery-18f089354e83eae5c98d998894d0f6ca9dd5f981.tar.bz2
g-sorcery-18f089354e83eae5c98d998894d0f6ca9dd5f981.zip
tests/test_DBGenerator
Diffstat (limited to 'tests')
-rw-r--r--tests/test_DBGenerator.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_DBGenerator.py b/tests/test_DBGenerator.py
index b5e40f8..9a47c86 100644
--- a/tests/test_DBGenerator.py
+++ b/tests/test_DBGenerator.py
@@ -52,6 +52,12 @@ class TestingDBGenerator(DBGenerator):
pkg_db.add_category(package.category)
pkg_db.add_package(package, ebuild_data)
+ def convert_internal_dependency(self, configs, dependency):
+ return ("internal", dependency)
+
+ def convert_external_dependency(self, configs, dependency):
+ return ("external", dependency)
+
class TestDBGenerator(BaseTest):
@@ -103,6 +109,19 @@ class TestDBGenerator(BaseTest):
pkg_set.remove(package)
self.assertTrue(not pkg_set)
+ orig = "test"
+ converted = "works"
+ internal = "int"
+ configs = [{}, {"converters": {orig:converted}, "external": {orig:converted}, "values": [orig, converted]}]
+
+ self.assertEqual(db_generator.convert(configs, "converters", orig), converted)
+ self.assertNotEqual(db_generator.convert(configs, "converters", "invalid"), converted)
+ self.assertEqual(db_generator.convert_dependency(configs, orig), ("external", converted))
+ self.assertEqual(db_generator.convert_dependency(configs, orig, external = False), None)
+ self.assertEqual(db_generator.convert_dependency(configs, internal), ("internal", internal))
+ self.assertTrue(db_generator.in_config(configs, "values", orig))
+ self.assertFalse(db_generator.in_config(configs, "values", "invalid"))
+
def suite():
suite = unittest.TestSuite()