~mvo/software-center/unity-lens-plus-wildcard-fix

« back to all changes in this revision

Viewing changes to tests/test_database.py

  • Committer: Michael Vogt
  • Date: 2012-08-21 09:48:18 UTC
  • Revision ID: michael.vogt@ubuntu.com-20120821094818-zrohx0zymniarbop
update db schema because we have the new APM key and add test for ensuring that the APM values are setup correclty

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
        self.assertEqual(res, [ v2, v1, v0 ])
78
78
 
79
79
 
 
80
    def _get_db_from_test_app_install_data(self):
 
81
        db = xapian.WritableDatabase(TEST_DB,
 
82
                                     xapian.DB_CREATE_OR_OVERWRITE)
 
83
        res = update_from_app_install_data(db, self.cache,
 
84
            datadir=os.path.join(DATA_DIR, "desktop"))
 
85
        self.assertTrue(res)
 
86
        self.assertEqual(db.get_doccount(), 5)
 
87
        return db
 
88
 
80
89
    def test_update_from_desktop_file(self):
81
90
        # ensure we index with german locales to test i18n
82
91
        os.environ["LANGUAGE"] = "de"
83
 
        db = xapian.WritableDatabase(TEST_DB,
84
 
                                     xapian.DB_CREATE_OR_OVERWRITE)
85
 
        res = update_from_app_install_data(db, self.cache,
86
 
            datadir=os.path.join(DATA_DIR, "desktop"))
87
 
        self.assertTrue(res)
88
 
        self.assertEqual(db.get_doccount(), 5)
 
92
        db = self._get_db_from_test_app_install_data()
89
93
        # test if Name[de] was picked up
90
94
        i=0
91
95
        for it in db.postlist("AAUbuntu Software Zentrum"):
92
96
            i+=1
 
97
 
 
98
    def test_name_mangling_for_query_parser(self):
 
99
        # test that pkgnames with "-" get added in a mangled form
 
100
        db = self._get_db_from_test_app_install_data()
 
101
        i=0
 
102
        for it in db.postlist("APMsoftware_center"):
 
103
            i+=1
93
104
        self.assertEqual(i, 1)
94
105
 
95
106
    def test_update_from_appstream_xml(self):