'Test for a non-banned user with no revisions that can be marked as spam.
We test the ban button text for a non-banned user who has either
no revisions or revisions already marked as spam.'

def test_not_banned_user_no_revisions_or_already_spam_ban_button(self):

    self.client.login(username='admin', password='testpass')
    ban_url = reverse('users.ban_user_and_cleanup', kwargs={'username': self.testuser.username})
    resp = self.client.get(ban_url, follow=True)
    eq_(200, resp.status_code)
    page = pq(resp.content)
    revisions_found = page.find('.dashboard-row')
    ban_button = page.find('#ban-and-cleanup-form    button[type=submit]')
    ban_other_reasons = page.find('#ban-for-other-reasons')
    eq_(len(revisions_found), 0)
    eq_(ban_button.text(), 'Ban    User    for    Spam')
    eq_(len(ban_other_reasons), 0)
    num_revisions = 3
    created_revisions = self.create_revisions(num=num_revisions, document=self.document, creator=self.testuser2)
    for revision in created_revisions:
        revision.akismet_submissions.add(RevisionAkismetSubmission(sender=self.testuser2, type='spam'))
    ban_url = reverse('users.ban_user_and_cleanup', kwargs={'username': self.testuser2.username})
    resp = self.client.get(ban_url, follow=True)
    eq_(200, resp.status_code)
    page = pq(resp.content)
    revisions_found = page.find('.dashboard-row')
    ban_button = page.find('#ban-and-cleanup-form    button[type=submit]')
    ban_other_reasons = page.find('#ban-for-other-reasons')
    eq_(len(revisions_found), 3)
    eq_(ban_button.text(), 'Ban    User    for    Spam')
    eq_(len(ban_other_reasons), 0)
