def test_update_from_json_string(self): db = xapian.inmemory_open() cache = apt.Cache() p = os.path.join(DATA_DIR, "app-info-json", "apps.json") res = update_from_json_string(db, cache, open(p).read(), origin=p) self.assertTrue(res) self.assertEqual(db.get_doccount(), 1)
def test_update_from_json_string(self): from softwarecenter.db.update import update_from_json_string db = xapian.WritableDatabase("./data/test.db", xapian.DB_CREATE_OR_OVERWRITE) cache = apt.Cache() p = os.path.abspath("./data/app-info-json/apps.json") res = update_from_json_string(db, cache, open(p).read(), origin=p) self.assertTrue(res) self.assertEqual(db.get_doccount(), 1)
def setUpClass(cls): cache = get_pkg_info() cache.open() db = xapian.WritableDatabase(TEST_DB, xapian.DB_CREATE_OR_OVERWRITE) update_from_json_string(db, cache, cls.APP_INFO_JSON, origin="local") db.close()