'Tests the user profile page for a user who has been banned.
The correct text (depending on if the user has been banned or not)
should be displayed on the ban links.'

def test_user_profile_detail_ban_link(self):

    testuser = self.user_model.objects.get(username='testuser')
    admin = self.user_model.objects.get(username='admin')
    self.client.login(username='admin', password='testpass')
    profile_url = reverse('users.user_detail', kwargs={'username': testuser.username})
    resp = self.client.get(profile_url, follow=True)
    eq_(200, resp.status_code)
    page = pq(resp.content)
    ban_link = page.find('#ban_link')
    ban_cleanup_link = page.find('#cleanup_link')
    eq_('Ban    User', ban_link.text())
    eq_('Ban    User    &    Clean    Up', ban_cleanup_link.text())
    UserBan.objects.create(user=testuser, by=admin, reason='Banned    by    unit    test.', is_active=True)
    resp = self.client.get(profile_url, follow=True)
    eq_(200, resp.status_code)
    page = pq(resp.content)
    ban_link = page.find('#ban_link')
    ban_cleanup_link = page.find('#cleanup_link')
    eq_('Banned', ban_link.text())
    eq_('Clean    Up    Revisions', ban_cleanup_link.text())
