'Rendering a document shouldn\'t affect feed contents, unless the
document content has actually been changed.'

def test_feed_unchanged_after_render(self):

    d1 = document(title='FeedDoc1', locale='en-US', save=True)
    revision(document=d1, save=True)
    time.sleep(1)
    d2 = document(title='FeedDoc2', locale='en-US', save=True)
    revision(document=d2, save=True)
    time.sleep(1)
    d3 = document(title='FeedDoc3', locale='en-US', save=True)
    revision(document=d3, save=True)
    time.sleep(1)
    d4 = document(title='FeedDoc4', locale='en-US', save=True)
    feed_url = reverse('wiki.feeds.recent_documents', locale='en-US', args=(), kwargs={'format': 'rss'})
    for d in (d1, d2, d3, d4):
        d.render(cache_control='no-cache')
    resp = self.client.get(feed_url)
    feed_hash_1 = hashlib.md5(resp.content).hexdigest()
    time.sleep(1)
    for d in (d1, d2, d3, d4):
        d.render(cache_control='no-cache')
    resp = self.client.get(feed_url)
    feed_hash_2 = hashlib.md5(resp.content).hexdigest()
    self.assertEqual(feed_hash_1, feed_hash_2)
    time.sleep(1)
    revision(document=d2, content='Hah!    An    edit!', save=True)
    for d in (d1, d2, d3, d4):
        d.render(cache_control='no-cache')
    resp = self.client.get(feed_url)
    feed_hash_3 = hashlib.md5(resp.content).hexdigest()
    self.assertTrue((feed_hash_2 != feed_hash_3))
