+ def test_source_exists(self):
+ 'test function source_exists()'
+
+ hello = self.source['hello']
+ self.assertTrue(source_exists(hello.source, hello.version, \
+ suites = ['sid'], session = self.session))
+ # binNMU
+ self.assertTrue(source_exists(hello.source, hello.version + '+b7', \
+ suites = ['sid'], session = self.session))
+ self.assertTrue(not source_exists(hello.source, hello.version, \
+ suites = ['lenny', 'squeeze'], session = self.session))
+ self.assertTrue(not source_exists(hello.source, hello.version, \
+ suites = ['lenny', 'sid'], session = self.session))
+ self.assertTrue(not source_exists(hello.source, hello.version, \
+ suites = ['sid', 'lenny'], session = self.session))
+ self.assertTrue(not source_exists(hello.source, '0815', \
+ suites = ['sid'], session = self.session))
+ # 'any' suite
+ self.assertTrue(source_exists(hello.source, hello.version, \
+ session = self.session))
+
+ def test_package_to_suite(self):
+ 'test function package_to_suite()'
+
+ pkg = Pkg()
+ pkg.changes = { 'distribution': {} }
+ upload = Upload(pkg)
+ self.assertTrue(not package_to_suite(upload, 'sid', self.session))
+ pkg.changes['distribution'] = { 'sid': '' }
+ pkg.changes['architecture'] = { 'source': '' }
+ self.assertTrue(package_to_suite(upload, 'sid', self.session))
+ pkg.changes['architecture'] = {}
+ pkg.changes['source'] = self.source['hello'].source
+ pkg.changes['version'] = self.source['hello'].version
+ self.assertTrue(not package_to_suite(upload, 'sid', self.session))
+ pkg.changes['version'] = '42'
+ self.assertTrue(package_to_suite(upload, 'sid', self.session))
+ pkg.changes['source'] = 'foobar'
+ pkg.changes['version'] = self.source['hello'].version
+ self.assertTrue(package_to_suite(upload, 'sid', self.session))
+ pkg.changes['distribution'] = { 'lenny': '' }
+ self.assertTrue(package_to_suite(upload, 'lenny', self.session))
+
+ def test_get_newest_source(self):
+ 'test function get_newest_source()'
+
+ import daklib.queue
+ daklib.queue.dm_suites = ['sid']
+ self.assertEqual(self.source['hello'], get_newest_source('hello', self.session))
+ self.assertEqual(None, get_newest_source('foobar', self.session))
+
+ def test_get_suite_version(self):
+ 'test function get_suite_version()'
+
+ result = get_suite_version('hello', self.session)
+ self.assertEqual(2, len(result))
+ self.assertTrue(('sid', '2.2-1') in result)
+ self.assertTrue(('sid', '2.2-2') in result)
+ result = get_suite_version('sl', self.session)
+ self.assertEqual(2, len(result))
+ self.assertTrue(('squeeze', '3.03-16') in result)
+ self.assertTrue(('sid', '3.03-16') in result)