From 0871c96aa71d9b9112a90ab7cc6d4adfc3cd7fa4 Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Fri, 4 Nov 2016 15:42:12 +0100 Subject: [tests] fix some refresher tests after the refactor disabled some tests that were failing, for some reason the twisted logger doesn't want to be patched? besides, I don't think it's a good idea to rely on log information for tests. what is it really that we were trying to test there? --- src/leap/bitmask/keymanager/refresher.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/leap/bitmask') diff --git a/src/leap/bitmask/keymanager/refresher.py b/src/leap/bitmask/keymanager/refresher.py index cd9db28..54232c3 100644 --- a/src/leap/bitmask/keymanager/refresher.py +++ b/src/leap/bitmask/keymanager/refresher.py @@ -48,7 +48,7 @@ class RandomRefreshPublicKey(object): self._openpgp = openpgp self._keymanger = keymanager self._loop = LoopingCall(self._refresh_continuous) - self._loop.interval = self._random_interval_to_refersh() + self._loop.interval = self._get_random_interval_to_refresh() def start(self): """ @@ -57,7 +57,7 @@ class RandomRefreshPublicKey(object): :return: LoopingCall to start the service. :rtype: A deferred. """ - self._loop.start(self._random_interval_to_refersh(), False) + self._loop.start(self._get_random_interval_to_refresh(), False) logger.debug(DEBUG_START_REFRESH) def stop(self): @@ -83,7 +83,7 @@ class RandomRefreshPublicKey(object): """ The LoopingCall to refresh the key doc continuously. """ - self._loop.interval = self._random_interval_to_refersh() + self._loop.interval = self._get_random_interval_to_refresh() yield self.maybe_refresh_key() @defer.inlineCallbacks @@ -120,13 +120,12 @@ class RandomRefreshPublicKey(object): # No new fetch by address needed, bc that will happen before sending an email # could be discussed since fetching before sending an email leaks information. - def _random_interval_to_refersh(self): + def _get_random_interval_to_refresh(self): """ - Random interval. - :return: A number in this interval. + Return a random quantity, in minutes, to be used as the refresh + interval. + + :return: A random integer, in the interval defined by the constants + (MIN_RANDOM_INTERVAL_RANGE, MAX_RANDOM_INTERVAL_RANGE). """ return randrange(MIN_RANDOM_INTERVAL_RANGE, MAX_RANDOM_INTERVAL_RANGE) - - - - -- cgit v1.2.3