Exemplo n.º 1
0
 def test_spinner_emits_signals(self):
     win = get_test_window_purchaseview()
     self.addCleanup(win.destroy)
     do_events_with_sleep()
     # get the view
     view = win.get_data("view")
     # ensure "purchase-needs-spinner" signals are send
     signal_mock = Mock()
     view.connect("purchase-needs-spinner", signal_mock)
     view.wk.webkit.load_uri("http://www.ubuntu.com/")
     do_events_with_sleep()
     self.assertTrue(signal_mock.called)
Exemplo n.º 2
0
 def test_purchase_view_tos(self):
     win = get_test_window_purchaseview()
     self.addCleanup(win.destroy)
     view = win.get_data("view")
     # install the mock
     mock_config = Mock()
     mock_config.user_accepted_tos = False
     view.config = mock_config
     func = "softwarecenter.ui.gtk3.views.purchaseview.show_accept_tos_dialog"
     with patch(func) as mock_func:
         mock_func.return_value = False
         res = view.initiate_purchase(None, None)
         self.assertFalse(res)
         self.assertTrue(mock_func.called)
Exemplo n.º 3
0
    def test_purchase_view_log_cleaner(self):
        win = get_test_window_purchaseview()
        self.addCleanup(win.destroy)
        do_events_with_sleep()
        # get the view
        view = win.get_data("view")
        # install the mock
        purchaseview.LOG = mock = Mock()
        # run a "harmless" log message and ensure its logged normally
        view.wk.webkit.execute_script('console.log("foo")')
        self.assertTrue("foo" in mock.debug.call_args[0][0])
        mock.reset_mock()

        # run a message that contains token info
        s = ('http://sca.razorgirl.info/subscriptions/19077/checkout_complete/'
             ' @10: {"token_key": "hiddenXXXXXXXXXX", "consumer_secret": '
             '"hiddenXXXXXXXXXXXX", "api_version": 2.0, "subscription_id": '
             '19077, "consumer_key": "rKhNPBw", "token_secret": '
             '"hiddenXXXXXXXXXXXXXXX"}')
        view.wk.webkit.execute_script("console.log('%s')" % s)
        self.assertTrue("skipping" in mock.debug.call_args[0][0])
        self.assertFalse("consumer_secret" in mock.debug.call_args[0][0])
        mock.reset_mock()
Exemplo n.º 4
0
 def test_purchaseview(self):
     win = get_test_window_purchaseview()
     self.addCleanup(win.destroy)