示例#1
0
文件: tests.py 项目: ajweb/tumblrBlog
 def testSyncIsOnWhenCacheOff(self):
     tumblrPosts.setOverrideTTL(0)
     # time is now, so with any TTL > 0 it should NOT refresh
     # with TTL=0 should always refresh
     self.assertTrue(tumblrPosts.refreshCacheNeeded(time.time())) 
     tumblrPosts.setOverrideTTL(10)
     self.assertFalse(tumblrPosts.refreshCacheNeeded(time.time()))
示例#2
0
文件: tests.py 项目: ajweb/tumblrBlog
 def testSyncTumblrWithCache(self):
     tumblrPosts.setOverrideTTL(0)
     models.Post.objects.all().delete()
     remotePosts = tumblrPosts.remotePosts(tumblrAPI)
     tumblrPosts.syncLocalPostsWith(remotePosts)
     localPosts = tumblrPosts.localPosts()
     self.assertTrue(tumblrPosts.isCacheSynced(localItems=localPosts, remoteItems=remotePosts))
示例#3
0
文件: tests.py 项目: ajweb/tumblrBlog
 def testCacheSetAndGetSetting(self):
     self.assertEquals(type(1), type(settings.TUMBLRBLOG_CACHE_TIME_TO_LIVE)) 
     tumblrPosts.setOverrideTTL(10)
     self.assertEquals(10, tumblrPosts.getTTL())