def test_memleak_app(self): options = Mock() options.display_navlog = False args = [] # ensure the cache is fully ready before taking the baseline cache = get_pkg_info() cache.open(blocking=True) app = SoftwareCenterAppGtk3(options, args) app.window_main.show_all() do_events_with_sleep() with TraceMemoryUsage("app._on_transaction_finished"): for i in range(self.ITERATIONS): app._on_transaction_finished(None, None) cache.open() do_events_with_sleep()
def test_deb_file_view_error(self): mock_options = get_mock_options() app = SoftwareCenterAppGtk3(mock_options) app.run(["./data/test_debs/gdebi-test1.deb"]) # give it time for i in range(10): time.sleep(0.1) do_events() # its ok to break out early if (app.available_pane.app_details_view and app.available_pane.app_details_view.get_property( "visible")): break # check that we are on the right page self.assertEqual(app.available_pane.get_current_page(), AvailablePane.Pages.DETAILS) # this is deb that is not installable action_button = app.available_pane.app_details_view.pkg_statusbar.button self.assertFalse(action_button.get_property("visible"))
def test_reinstall_previous_purchase_display(self): mock_options = get_mock_options() xapiandb = "/var/cache/software-center/" app = SoftwareCenterAppGtk3(softwarecenter.paths.datadir, xapiandb, mock_options) # real app opens cache async app.cache.open() # show it app.window_main.show_all() app.available_pane.init_view() self._p() app.on_menuitem_reinstall_purchases_activate(None) # it can take a bit until the sso client is ready for i in range(100): if (app.available_pane.get_current_page() == AvailablePane.Pages.LIST): break self._p() self.assertEqual(app.available_pane.get_current_page(), AvailablePane.Pages.LIST)
def test_reinstall_previous_purchase_display(self, mock_find_token): mock_find_token.return_value = {'not': 'important'} mock_options = get_mock_options() app = SoftwareCenterAppGtk3(mock_options) self.addCleanup(app.destroy) # real app opens cache async app.cache.open() # .. and now pretend we clicked on the menu item app.window_main.show_all() app.available_pane.init_view() do_events_with_sleep() app.on_menuitem_reinstall_purchases_activate(None) # it can take a bit until the sso client is ready for i in range(10): if (app.available_pane.get_current_page() == AvailablePane.Pages.LIST): break do_events_with_sleep() self.assertEqual(app.available_pane.get_current_page(), AvailablePane.Pages.LIST)
def test_reinstall_previous_purchase_display(self): os.environ["PYTHONPATH"]=".." mock_options = Mock() mock_options.display_navlog = False mock_options.disable_apt_xapian_index = False mock_options.disable_buy = False xapiandb = "/var/cache/software-center/" app = SoftwareCenterAppGtk3( softwarecenter.paths.datadir, xapiandb, mock_options) app.window_main.show_all() app.available_pane.init_view() self._p() app.on_menuitem_reinstall_purchases_activate(None) # it can take a bit until the sso client is ready for i in range(100): if (app.available_pane.get_current_page() == AvailablePane.Pages.LIST): break self._p() self.assertEqual( app.available_pane.get_current_page(), AvailablePane.Pages.LIST)
def test_deb_file_view_error(self): mock_options = Mock() mock_options.display_navlog = False mock_options.disable_apt_xapian_index = False mock_options.disable_buy = False xapianpath = softwarecenter.paths.XAPIAN_BASE_PATH app = SoftwareCenterAppGtk3(softwarecenter.paths.datadir, xapianpath, mock_options) app.run(["./data/test_debs/gdebi-test1.deb"]) # give it time for i in range(10): time.sleep(0.1) do_events() # its ok to break out early if (app.available_pane.app_details_view and app.available_pane.app_details_view.get_property( "visible")): break # check that we are on the right page self.assertEqual(app.available_pane.get_current_page(), AvailablePane.Pages.DETAILS) # this is deb that is not installable action_button = app.available_pane.app_details_view.pkg_statusbar.button self.assertFalse(action_button.get_property("visible"))