本文整理汇总了Python中softwarecenter.testutils.get_test_db函数的典型用法代码示例。如果您正苦于以下问题:Python get_test_db函数的具体用法?Python get_test_db怎么用?Python get_test_db使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_test_db函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_test_window
def get_test_window():
from softwarecenter.testutils import (get_test_db,
get_test_datadir,
get_test_gtk3_viewmanager,
get_test_pkg_info,
get_test_gtk3_icon_cache,
)
# needed because available pane will try to get it
vm = get_test_gtk3_viewmanager()
vm # make pyflakes happy
db = get_test_db()
cache = get_test_pkg_info()
datadir = get_test_datadir()
icons = get_test_gtk3_icon_cache()
w = InstalledPane(cache, db, 'Ubuntu', icons, datadir)
w.show()
win = Gtk.Window()
win.set_data("pane", w)
win.add(w)
win.set_size_request(400, 600)
win.connect("destroy", lambda x: Gtk.main_quit())
# init the view
w.init_view()
from softwarecenter.backend.channel import AllInstalledChannel
w.state.channel = AllInstalledChannel()
w.display_overview_page(None, None)
win.show()
return win
示例2: get_test_window
def get_test_window():
from softwarecenter.testutils import (
get_test_db, get_test_pkg_info, get_test_gtk3_icon_cache)
from softwarecenter.db.enquire import AppEnquire
from softwarecenter.ui.gtk3.models.appstore2 import AppListStore
import xapian
db = get_test_db()
cache = get_test_pkg_info()
icons = get_test_gtk3_icon_cache()
# create the view
appview = AppView(db, cache, icons, show_ratings=True)
liststore = AppListStore(db, cache, icons)
appview.set_model(liststore)
# do a simple query and display that
enquirer = AppEnquire(cache, db)
enquirer.set_query(xapian.Query(""),
sortmode=SortMethods.BY_CATALOGED_TIME,
limit=20,
nonblocking_load=False)
appview.display_matches(enquirer.matches)
# and put it in the window
win = Gtk.Window()
win.add(appview)
win.set_data("appview", appview)
win.connect("destroy", lambda x: Gtk.main_quit())
win.set_size_request(600, 400)
win.show_all()
return win
示例3: get_test_window
def get_test_window():
import softwarecenter.log
softwarecenter.log.root.setLevel(level=logging.DEBUG)
fmt = logging.Formatter("%(name)s - %(message)s", None)
softwarecenter.log.handler.setFormatter(fmt)
# this is *way* to complicated we should *not* need a CatView
# here! see FIXME in RecommendationsPanel.__init__()
from softwarecenter.ui.gtk3.views.catview_gtk import CategoriesViewGtk
from softwarecenter.testutils import (
get_test_db, get_test_pkg_info, get_test_gtk3_icon_cache)
cache = get_test_pkg_info()
db = get_test_db()
icons = get_test_gtk3_icon_cache()
catview = CategoriesViewGtk(softwarecenter.paths.datadir,
softwarecenter.paths.APP_INSTALL_PATH,
cache,
db,
icons)
view = RecommendationsPanelLobby(catview)
win = Gtk.Window()
win.connect("destroy", lambda x: Gtk.main_quit())
win.add(view)
win.set_data("rec_panel", view)
win.set_size_request(600, 200)
win.show_all()
return win
示例4: setUpClass
def setUpClass(cls):
# Set these as class attributes as we don't modify either
# during the tests.
cls.win = get_test_window_appdetails()
cls.view = cls.win.get_data("view")
from softwarecenter.testutils import get_test_db
cls.db = get_test_db()
示例5: get_test_window
def get_test_window():
from softwarecenter.testutils import (get_test_db,
get_test_gtk3_viewmanager,
get_test_pkg_info,
get_test_gtk3_icon_cache,
)
# needed because available pane will try to get it
vm = get_test_gtk3_viewmanager()
vm # make pyflakes happy
db = get_test_db()
cache = get_test_pkg_info()
icons = get_test_gtk3_icon_cache()
widget = HistoryPane(cache, db, None, icons, None)
widget.show()
win = Gtk.Window()
win.add(widget)
win.set_size_request(600, 500)
win.set_position(Gtk.WindowPosition.CENTER)
win.show_all()
win.connect('destroy', Gtk.main_quit)
widget.init_view()
return win
示例6: get_test_window
def get_test_window():
from softwarecenter.testutils import (
get_test_db, get_test_pkg_info, get_test_gtk3_icon_cache,
get_test_enquirer_matches)
from softwarecenter.ui.gtk3.models.appstore2 import AppListStore
db = get_test_db()
cache = get_test_pkg_info()
icons = get_test_gtk3_icon_cache()
# create the view
appview = AppView(db, cache, icons, show_ratings=True)
liststore = AppListStore(db, cache, icons)
appview.set_model(liststore)
# do a simple query and display that
appview.display_matches(get_test_enquirer_matches(db))
# and put it in the window
win = Gtk.Window()
win.add(appview)
win.set_data("appview", appview)
win.connect("destroy", lambda x: Gtk.main_quit())
win.set_size_request(600, 400)
win.show_all()
return win
示例7: test_appdetails
def test_appdetails(self):
from softwarecenter.testutils import get_test_db
db = get_test_db()
# see "apt-cache show casper|grep ^Tag"
details = AppDetails(db, application=Application("", "casper"))
self.assertTrue(len(details.tags) > 2)
示例8: test_not_automatic_version
def test_not_automatic_version(self):
db = get_test_db()
app = Application("", "software-center")
details = app.get_details(db)
normal_version = self._make_version(not_automatic=False)
not_automatic_version = self._make_version(not_automatic=True)
details._pkg.versions = [normal_version, not_automatic_version]
# force not-automatic with invalid data
self.assertRaises(
ValueError, details.force_not_automatic_archive_suite, "random-string")
# force not-automatic with valid data
self.assertTrue(details.force_not_automatic_archive_suite(
not_automatic_version.origins[0].archive))
# ensure we get the description of the not-automatic version
self.assertEqual(details.description,
not_automatic_version.description)
self.assertEqual(details.summary,
not_automatic_version.summary)
self.assertEqual(details.version,
not_automatic_version.version)
self.assertEqual(app.archive_suite,
not_automatic_version.origins[0].archive)
# clearing works
details.force_not_automatic_archive_suite("")
self.assertEqual(app.archive_suite, "")
示例9: get_test_window
def get_test_window():
from softwarecenter.testutils import (
get_test_db,
get_test_datadir,
get_test_gtk3_viewmanager,
get_test_pkg_info,
get_test_gtk3_icon_cache,
)
# needed because available pane will try to get it
vm = get_test_gtk3_viewmanager()
vm # make pyflakes happy
db = get_test_db()
cache = get_test_pkg_info()
datadir = get_test_datadir()
icons = get_test_gtk3_icon_cache()
navhistory_back_action = Gtk.Action("navhistory_back_action", "Back", "Back", None)
navhistory_forward_action = Gtk.Action("navhistory_forward_action", "Forward", "Forward", None)
w = AvailablePane(cache, db, "Ubuntu", icons, datadir, navhistory_back_action, navhistory_forward_action)
w.init_view()
w.show()
win = Gtk.Window()
win.connect("destroy", Gtk.main_quit)
win.add(w)
win.set_size_request(800, 600)
win.show_all()
# this is used later in tests
win.set_data("pane", w)
return win
示例10: test_new_no_sort_info_yet
def test_new_no_sort_info_yet(self):
# ensure that we don't show a empty "whats new" category
# see LP: #865985
from softwarecenter.testutils import get_test_db
db = get_test_db()
cache = db._aptcache
# simulate a fresh install with no catalogedtime info
del db._axi_values["catalogedtime"]
from softwarecenter.testutils import get_test_gtk3_icon_cache
icons = get_test_gtk3_icon_cache()
from softwarecenter.db.appfilter import AppFilter
apps_filter = AppFilter(db, cache)
from softwarecenter.distro import get_distro
from softwarecenter.ui.gtk3.views.catview_gtk import LobbyViewGtk
view = LobbyViewGtk(softwarecenter.paths.datadir,
softwarecenter.paths.APP_INSTALL_PATH,
cache, db, icons, get_distro(), apps_filter)
view.show()
# gui
win = Gtk.Window()
self.addCleanup(win.destroy)
win.set_size_request(800, 400)
scroll = Gtk.ScrolledWindow()
scroll.add(view)
scroll.show()
win.add(scroll)
win.show()
# test visibility
do_events()
self.assertFalse(view.whats_new_frame.get_property("visible"))
示例11: get_test_window_viewswitcher
def get_test_window_viewswitcher():
from softwarecenter.testutils import (get_test_db,
get_test_datadir,
get_test_gtk3_viewmanager,
get_test_pkg_info,
get_test_gtk3_icon_cache,
)
cache = get_test_pkg_info()
db = get_test_db()
icons = get_test_gtk3_icon_cache()
datadir = get_test_datadir()
manager = get_test_gtk3_viewmanager()
view = ViewSwitcher(manager, datadir, db, cache, icons)
scroll = Gtk.ScrolledWindow()
box = Gtk.VBox()
box.pack_start(scroll, True, True, 0)
win = Gtk.Window()
scroll.add_with_viewport(view)
win.add(box)
win.set_size_request(400,200)
win.connect("destroy", Gtk.main_quit)
win.show_all()
return win
示例12: test_generic
def test_generic(self):
from softwarecenter.backend.channel import ChannelsManager
db = get_test_db()
m = ChannelsManager(db)
channels = m._get_channels_from_db(installed_only=False)
self.assertNotEqual(channels, [])
channels_installed = m._get_channels_from_db(installed_only=True)
self.assertNotEqual(channels_installed, [])
示例13: test_aptchannels
def test_aptchannels(self):
from softwarecenter.backend.channel_impl.aptchannels import AptChannelsManager
db = get_test_db()
m = AptChannelsManager(db)
channels = m.channels
self.assertNotEqual(channels, [])
channels_installed = m.channels_installed_only
self.assertNotEqual(channels_installed, [])
示例14: disabled_test_recagent_post_submit_profile
def disabled_test_recagent_post_submit_profile(self):
# NOTE: This requires a working recommender host that is reachable
recommender_agent = RecommenderAgent()
recommender_agent.connect("submit-profile-finished", self.on_query_done)
recommender_agent.connect("error", self.on_query_error)
db = get_test_db()
recommender_agent.post_submit_profile(db)
self.loop.run()
self.assertFalse(self.error)
示例15: test_utils_get_installed_apps_list
def test_utils_get_installed_apps_list(self):
from softwarecenter.db.utils import get_installed_package_list, get_installed_apps_list
db = get_test_db()
# installed pkgs
installed_pkgs = get_installed_package_list()
# the installed apps
installed_apps = get_installed_apps_list(db)
self.assertTrue(len(installed_apps) > 0)
self.assertTrue(len(installed_pkgs) > len(installed_apps))