コード例 #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())