Ejemplo n.º 1
0
    def setUp(self):
        super(AppTestCase, self).setUp()
        self.called = defaultdict(list)
        self.addCleanup(self.called.clear)

        orig = app.SoftwareCenterAppGtk3.START_DBUS
        self.addCleanup(setattr, app.SoftwareCenterAppGtk3, 'START_DBUS', orig)
        app.SoftwareCenterAppGtk3.START_DBUS = False

        orig = app.get_pkg_info
        self.addCleanup(setattr, app, 'get_pkg_info', orig)
        app.get_pkg_info = lambda: FakedCache()

        options = get_mock_options()
        self.app = app.SoftwareCenterAppGtk3(options)
        self.addCleanup(self.app.destroy)

        self.app.cache.open()

        # connect some signals of interest
        cid = self.app.installed_pane.connect('installed-pane-created',
                partial(self.track_calls, 'pane-created'))
        self.addCleanup(self.app.installed_pane.disconnect, cid)

        cid = self.app.available_pane.connect('available-pane-created',
                partial(self.track_calls, 'pane-created'))
        self.addCleanup(self.app.available_pane.disconnect, cid)
Ejemplo n.º 2
0
    def setUp(self):
        super(AppTestCase, self).setUp()
        self.called = defaultdict(list)
        self.addCleanup(self.called.clear)

        orig = app.SoftwareCenterAppGtk3.START_DBUS
        self.addCleanup(setattr, app.SoftwareCenterAppGtk3, 'START_DBUS', orig)
        app.SoftwareCenterAppGtk3.START_DBUS = False

        orig = app.get_pkg_info
        self.addCleanup(setattr, app, 'get_pkg_info', orig)
        app.get_pkg_info = lambda: FakedCache()

        options = get_mock_options()
        self.app = app.SoftwareCenterAppGtk3(options)
        self.addCleanup(self.app.destroy)

        self.app.cache.open()

        # connect some signals of interest
        cid = self.app.installed_pane.connect(
            'installed-pane-created', partial(self.track_calls,
                                              'pane-created'))
        self.addCleanup(self.app.installed_pane.disconnect, cid)

        cid = self.app.available_pane.connect(
            'available-pane-created', partial(self.track_calls,
                                              'pane-created'))
        self.addCleanup(self.app.available_pane.disconnect, cid)
Ejemplo n.º 3
0
 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"))
Ejemplo n.º 4
0
 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"))
Ejemplo n.º 5
0
 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)