本文整理汇总了Python中softwarecenter.testutils.get_test_db函数的典型用法代码示例。如果您正苦于以下问题:Python get_test_db函数的具体用法?Python get_test_db怎么用?Python get_test_db使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_test_db函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
开发者ID:armikhael,项目名称:software-center,代码行数:33,代码来源:installedpane.py
示例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
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:34,代码来源:appview.py
示例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
开发者ID:cs2c,项目名称:AppStream,代码行数:30,代码来源:recommendations.py
示例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()
开发者ID:feiying,项目名称:AppStream,代码行数:7,代码来源:test_appdetailsview.py
示例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
开发者ID:fossasia,项目名称:x-mario-center,代码行数:26,代码来源:historypane.py
示例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
开发者ID:armikhael,项目名称:software-center,代码行数:28,代码来源:appview.py
示例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)
开发者ID:pombredanne,项目名称:xmario_center,代码行数:7,代码来源:test_database.py
示例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, "")
开发者ID:cs2c,项目名称:AppStream,代码行数:25,代码来源:test_database.py
示例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
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:34,代码来源:availablepane.py
示例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"))
开发者ID:fossasia,项目名称:x-mario-center,代码行数:35,代码来源:test_catview.py
示例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
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:27,代码来源:viewswitcher.py
示例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, [])
开发者ID:armikhael,项目名称:software-center,代码行数:8,代码来源:test_channels.py
示例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, [])
开发者ID:pombredanne,项目名称:AppStream,代码行数:9,代码来源:test_channels.py
示例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)
开发者ID:cs2c,项目名称:AppStream,代码行数:9,代码来源:test_recagent.py
示例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))
开发者ID:pombredanne,项目名称:xmario_center,代码行数:10,代码来源:test_database.py
示例16: test_not_automatic_channel_support
def test_not_automatic_channel_support(self):
db = get_test_db()
app = Application("", "software-center")
details = app.get_details(db)
versions = [self._make_version(not_automatic=True), self._make_version(not_automatic=False)]
details._pkg.versions = versions
details._pkg.candidate = versions[1]
self.assertEqual(
details.get_not_automatic_archive_versions(),
[(versions[1].version, "precise"), (versions[0].version, "precise-backports")],
)
开发者ID:pombredanne,项目名称:xmario_center,代码行数:11,代码来源:test_database.py
示例17: setUp
def setUp(self):
# get required test stuff
self.db = get_test_db()
self.backend = Mock()
self.distro = get_distro()
self.datadir = softwarecenter.paths.datadir
self.icons = get_test_gtk3_icon_cache()
# create it once, it becomes global instance
if get_appmanager() is None:
ApplicationManager(
self.db, self.backend, self.icons)
开发者ID:feiying,项目名称:AppStream,代码行数:11,代码来源:test_appmanager.py
示例18: test_multiple_version_pkg_states
def test_multiple_version_pkg_states(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]
details._pkg.installed = normal_version
details._pkg.is_installed = True
details._pkg.is_upgradable = True
self.assertEqual(details.pkg_state, PkgStates.UPGRADABLE)
app.archive_suite = not_automatic_version
self.assertEqual(details.pkg_state, PkgStates.FORCE_VERSION)
开发者ID:cs2c,项目名称:AppStream,代码行数:13,代码来源:test_database.py
示例19: test_multiple_versions_sorting
def test_multiple_versions_sorting(self):
db = get_test_db()
app = Application("", "software-center")
details = AppDetails(db, application=app)
details._pkg = Mock()
details._pkg.installed = Mock()
details._pkg.installed.version = "2.0"
self.assertEqual(details.version, "2.0")
v0 = {"version": None}
v1 = {"version": "1.0"}
v2 = {"version": "2.0"}
v3 = {"version": "3.0"}
screenshots_list = [v0, v1, v2, v3]
res = details._sort_screenshots_by_best_version(screenshots_list)
self.assertEqual(res, [v2, v1, v0])
开发者ID:pombredanne,项目名称:xmario_center,代码行数:15,代码来源:test_database.py
示例20: test_mocked_recagent_post_submit_profile
def test_mocked_recagent_post_submit_profile(self, mock_spawn_helper_run):
def _patched_on_submit_profile_data(*args, **kwargs):
piston_submit_profile = {}
recommender_agent.emit("submit-profile-finished",
piston_submit_profile)
mock_spawn_helper_run.side_effect = _patched_on_submit_profile_data
recommender_agent = RecommenderAgent()
recommender_agent.connect("submit-profile-finished", self.on_query_done)
recommender_agent.connect("error", self.on_query_error)
recommender_agent._calc_profile_id = lambda profile: "i-am-random"
db = get_test_db()
recommender_agent.post_submit_profile(db)
self.assertFalse(self.error)
args, kwargs = mock_spawn_helper_run.call_args
self.assertNotEqual(kwargs['data'][0]['package_list'], [])
开发者ID:feiying,项目名称:AppStream,代码行数:15,代码来源:test_recagent.py
注:本文中的softwarecenter.testutils.get_test_db函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论