5
sys.path.insert(0,"../")
7
from softwarecenter.enums import *
8
from softwarecenter.utils import *
10
from softwarecenter.apt.aptcache import AptCache
11
from softwarecenter.db.database import StoreDatabase
12
from softwarecenter.view.catview import CategoriesView, Category, get_category_by_name
15
class TestCatParsing(unittest.TestCase):
16
""" tests the "where is it in the menu" code """
21
xapian_base_path = XAPIAN_BASE_PATH
22
pathname = os.path.join(xapian_base_path, "xapian")
23
self.db = StoreDatabase(pathname, cache)
25
self.catview = CategoriesView()
26
self.catview.db = self.db
27
self.cats = self.catview.parse_applications_menu('/usr/share/app-install')
29
def test_get_cat_by_name(self):
30
cat = get_category_by_name(self.cats, 'Games')
31
self.assertEqual(cat.untranslated_name, 'Games')
32
cat = get_category_by_name(self.cats, 'Featured')
33
self.assertEqual(cat.untranslated_name, 'Featured')
35
def test_cat_has_flags(self):
36
cat = get_category_by_name(self.cats, 'Featured')
37
self.assertEqual(cat.flags[0], 'carousel-only')
40
if __name__ == "__main__":
42
logging.basicConfig(level=logging.DEBUG)