本文整理汇总了Python中softwarecenter.db.database.StoreDatabase.get_xapian_document方法的典型用法代码示例。如果您正苦于以下问题:Python StoreDatabase.get_xapian_document方法的具体用法?Python StoreDatabase.get_xapian_document怎么用?Python StoreDatabase.get_xapian_document使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类softwarecenter.db.database.StoreDatabase
的用法示例。
在下文中一共展示了StoreDatabase.get_xapian_document方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: disabled_test_for_purchase_apps_cataloged_time
# 需要导入模块: from softwarecenter.db.database import StoreDatabase [as 别名]
# 或者: from softwarecenter.db.database.StoreDatabase import get_xapian_document [as 别名]
def disabled_test_for_purchase_apps_cataloged_time(self):
from softwarecenter.testutils import get_test_pkg_info
#os.environ["SOFTWARE_CENTER_DEBUG_HTTP"] = "1"
os.environ["SOFTWARE_CENTER_AGENT_HOST"] = "http://sc.staging.ubuntu.com/"
# staging does not have a valid cert
os.environ["PISTON_MINI_CLIENT_DISABLE_SSL_VALIDATION"] = "1"
cache = get_test_pkg_info()
db = xapian.WritableDatabase("./data/test.db",
xapian.DB_CREATE_OR_OVERWRITE)
res = update_from_software_center_agent(db, cache, ignore_cache=True)
self.assertTrue(res)
res = update_from_app_install_data(db, self.cache, datadir="./data/desktop")
self.assertTrue(res)
db = StoreDatabase("./data/test.db", self.cache)
db.open(use_axi=True)
axi_value_time = db._axi_values["catalogedtime"]
sc_app = Application("Ubuntu Software Center Test", "software-center")
sc_doc = db.get_xapian_document(sc_app.appname, sc_app.pkgname)
sc_cataloged_time = sc_doc.get_value(axi_value_time)
for_purch_app = Application("For Purchase Test App", "hellox")
for_purch_doc = db.get_xapian_document(for_purch_app.appname,
for_purch_app.pkgname)
for_purch_cataloged_time = for_purch_doc.get_value(axi_value_time)
# the for-purchase test package should be cataloged at a
# later time than axi package Ubuntu Software Center
self.assertTrue(for_purch_cataloged_time > sc_cataloged_time)
del os.environ["SOFTWARE_CENTER_AGENT_HOST"]
示例2: test_non_axi_apps_cataloged_time
# 需要导入模块: from softwarecenter.db.database import StoreDatabase [as 别名]
# 或者: from softwarecenter.db.database.StoreDatabase import get_xapian_document [as 别名]
def test_non_axi_apps_cataloged_time(self):
db = xapian.WritableDatabase("./data/test.db",
xapian.DB_CREATE_OR_OVERWRITE)
res = update_from_app_install_data(db, self.cache, datadir="./data/desktop")
self.assertTrue(res)
db = StoreDatabase("./data/test.db", self.cache)
db.open(use_axi=True)
axi_value_time = db._axi_values["catalogedtime"]
sc_app = Application("Ubuntu Software Center Test", "software-center")
sc_doc = db.get_xapian_document(sc_app.appname, sc_app.pkgname)
sc_cataloged_time = sc_doc.get_value(axi_value_time)
so_app = Application("Scintillant Orange", "scintillant-orange")
so_doc = db.get_xapian_document(so_app.appname, so_app.pkgname)
so_cataloged_time = so_doc.get_value(axi_value_time)
# the test package Scintillant Orange should be cataloged at a
# later time than axi package Ubuntu Software Center
self.assertTrue(so_cataloged_time > sc_cataloged_time)