Esempio n. 1
0
 def test_checking_timeouts(self):
     settings = self._settings()
     ctrl = UpdateNotifierController(settings)
     def throwTimeoutError():
         raise urllib2.URLError('timeout')
     ctrl._get_newest_version = throwTimeoutError
     ctrl.notify_update_if_needed(self._callback)
     self.assertTrue(settings['last update check'] > time.time() - 1)
     self.assertFalse(self._callback_called)
Esempio n. 2
0
 def _update_notifier_controller(self,
                                 settings,
                                 current,
                                 new,
                                 url='some url'):
     ctrl = UpdateNotifierController(settings)
     ctrl.VERSION = current
     ctrl._get_newest_version = lambda: new
     ctrl._get_download_url = lambda v: url if v == new else None
     return ctrl
Esempio n. 3
0
    def test_checking_timeouts(self):
        settings = self._settings()
        ctrl = UpdateNotifierController(settings)

        def throwTimeoutError():
            raise urllib2.URLError('timeout')

        ctrl._get_newest_version = throwTimeoutError
        ctrl.notify_update_if_needed(self._callback)
        self.assertTrue(settings['last update check'] > time.time() - 1)
        self.assertFalse(self._callback_called)
Esempio n. 4
0
 def _update_notifier_controller(self, settings, current, new, url='some url'):
     ctrl = UpdateNotifierController(settings)
     ctrl.VERSION = current
     ctrl._get_newest_version = lambda: new
     ctrl._get_download_url   = lambda v: url if v == new else None
     return ctrl