'Make sure documents with REDIRECT directives redirect properly.
Also check the backlink to the redirect page.'

def test_redirect(self):

    target = document(save=True)
    target_url = target.get_absolute_url()
    redirect_html = (REDIRECT_CONTENT % dict(title='Boo', href=target_url))
    redirect = document(html=redirect_html)
    redirect.save()
    redirect_url = redirect.get_absolute_url()
    self.client.login(username='admin', password='testpass')
    response = self.client.get(redirect_url, follow=True)
    self.assertRedirects(response, urlparams(target_url), status_code=301)
    self.assertContains(response, redirect_url)
