def test_refetch_unchanged_syndication(self): """We should preserve unchanged SyndicatedPosts during refetches.""" synd = SyndicatedPost(parent=self.source.key, original='http://author/permalink', syndication='https://fa.ke/post/url') synd.put() self.expect_requests_get('http://author', """ <html class="h-feed"> <div class="h-entry"> <a class="u-url" href="/permalink"></a> <a class="u-syndication" href="https://fa.ke/post/url"></a> </div> </html>""") self.mox.ReplayAll() refetch(self.source) self.assert_entities_equal([synd], list(SyndicatedPost.query()))
def test_refetch_blank_syndication(self): """We should preserve blank SyndicatedPosts during refetches.""" blank = SyndicatedPost(parent=self.source.key, original='http://author/permalink', syndication=None) blank.put() self.expect_requests_get('http://author', """ <html class="h-feed"> <div class="h-entry"> <a class="u-url" href="/permalink"></a> </div> </html>""") self.expect_requests_get('http://author/permalink', """ <html class="h-entry"> <a class="u-url" href="/permalink"></a> </html>""") self.mox.ReplayAll() self.assert_equals({}, refetch(self.source)) self.assert_syndicated_posts(('http://author/permalink', None))