def test_list_locations(self): OUT.color_off() db = WebappDB(root = '/'.join((HERE, 'testfiles', 'webapps'))) sorted_db = [i[1] for i in db.list_locations().items()] sorted_db.sort(key=lambda x: x[0]+x[1]+x[2]) self.assertEqual(sorted_db[1], ['', 'gallery', '2.0_rc2']) # Now test with a specific package and version: db = WebappDB(root = '/'.join((HERE, 'testfiles', 'webapps')), package = 'horde', version = '3.0.5') sorted_db = [i[1] for i in db.list_locations().items()] self.assertEqual(sorted_db, [['', 'horde', '3.0.5']]) # Now test with an install file that doesn't exist: db = WebappDB(root = '/'.join((HERE, 'testfiles', 'webapps')), package = 'nihil', version = '3.0.5') sorted_db = [i[1] for i in db.list_locations().items()] self.assertEqual(sorted_db, [])
def test_list_locations(self): OUT.color_off() db = WebappDB(root='/'.join((HERE, 'testfiles', 'webapps'))) sorted_db = [i[1] for i in db.list_locations().items()] sorted_db.sort(key=lambda x: x[0] + x[1] + x[2]) self.assertEqual(sorted_db[1], ['', 'gallery', '2.0_rc2']) # Now test with a specific package and version: db = WebappDB(root='/'.join((HERE, 'testfiles', 'webapps')), package='horde', version='3.0.5') sorted_db = [i[1] for i in db.list_locations().items()] self.assertEqual(sorted_db, [['', 'horde', '3.0.5']]) # Now test with an install file that doesn't exist: db = WebappDB(root='/'.join((HERE, 'testfiles', 'webapps')), package='nihil', version='3.0.5') sorted_db = [i[1] for i in db.list_locations().items()] self.assertEqual(sorted_db, [])