Example #1
0
 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)
Example #2
0
 def test_appmanager_requests_oauth_token(self):
     oauth_token = {
         "moo": "bar",
         "lala": "la",
     }
     # reset the global appmanager
     softwarecenter.ui.gtk3.session.appmanager._appmanager = None
     with patch("softwarecenter.ui.gtk3.session.appmanager.UbuntuSSO"
                ".find_oauth_token_sync") as m:
         m.return_value = oauth_token
         app_manager = ApplicationManager(self.db, self.backend, self.icons)
         self.assertEqual(app_manager.oauth_token, oauth_token)
def get_test_window():
    from softwarecenter.testutils import (
        get_test_db,
        get_test_datadir,
        get_test_install_backend,
        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()
    backend = get_test_install_backend()

    # create global AppManager instance
    from softwarecenter.ui.gtk3.session.appmanager import ApplicationManager
    ApplicationManager(db, backend, icons)

    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