Exemple #1
0
    def test_reset_does_expire(self, _update_cache_data):
        mydict = CachedDict(timeout=100)
        mydict._cache = {}
        mydict._last_updated = time.time()
        mydict._populate(reset=True)

        _update_cache_data.assert_called_once_with()
Exemple #2
0
    def test_does_not_expire_by_default(self, _update_cache_data):
        mydict = CachedDict(timeout=100)
        mydict._cache = {}
        mydict._last_updated = time.time()
        mydict._populate()

        self.assertFalse(_update_cache_data.called)
Exemple #3
0
    def test_expired_does_update_data(self, _update_cache_data):
        mydict = CachedDict()
        mydict._cache = {}
        mydict._last_updated = time.time()
        mydict._populate()

        _update_cache_data.assert_called_once_with()