This will be True if the last result was cached.
Otherwise this will be False if the result was freshly
requested from the Twitter API servers.
}
self.assertTrue(expected_dict in languages)
+ def testcachedresult(self):
+ self.api.cache = MemoryCache()
+ self.api.home_timeline()
+ self.assertFalse(self.api.cached_result)
+ self.api.home_timeline()
+ self.assertTrue(self.api.cached_result)
+
class TweepyCacheTests(unittest.TestCase):
timeout = 2.0
self.path = self.path.replace(variable, value)
def execute(self):
+ self.api.cached_result = False
+
# Build the request URL
url = self.api_root + self.path
if len(self.parameters):
else:
if isinstance(cache_result, Model):
cache_result._api = self.api
+ self.api.cached_result = True
return cache_result
# Continue attempting request until successful