Пример #1
0
 def testLocalAndRemotePostsSynced(self):
     self.savePostsToCache(generateTestPosts(5))
     localPosts = tumblrPosts.localPosts()
     # passing same lists of posts should return True
     self.assertTrue(tumblrPosts.isCacheSynced(localItems=localPosts, remoteItems=localPosts))
     self.savePostsToCache(generateTestPosts(2))
     localPosts2 = tumblrPosts.localPosts()
     # it should require syncing if the lists of posts are not identical
     self.assertFalse(tumblrPosts.isCacheSynced(localItems=localPosts, remoteItems=localPosts2))
Пример #2
0
 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))