'Delete link should appear on the summary page sometimes.
This should occur if: 1.) The user created the document and
2.) the document has no other revision.
The places in the template where this link may occur are:
1.) Reverted or 2.) New action by user or 3.) Already identified as spam.
Check all of these places in this test.'

@patch('kuma.wiki.forms.RevisionAkismetSubmissionSpamForm.is_valid')
def test_delete_link_appears_summary_page(self, mock_form):

    mock_form.return_value = True
    doc1 = create_document(save=True)
    rev_doc1 = create_revision(title='Revision    0', document=doc1, creator=self.testuser, save=True)
    doc2 = create_document(save=True)
    rev_doc2 = create_revision(title='Revision    0', document=doc2, creator=self.testuser, save=True)
    self.client.login(username='admin', password='testpass')
    ban_url = reverse('users.ban_user_and_cleanup_summary', kwargs={'username': self.testuser.username})
    full_ban_url = self.client.get(ban_url)['Location']
    data = {'revision-id': [rev_doc1.id], 'revision-already-spam': [rev_doc2.id]}
    resp = self.client.post(full_ban_url, data=data)
    eq_(200, resp.status_code)
    page = pq(resp.content)
    doc2_delete_url = reverse('wiki.delete_document', kwargs={'document_path': doc2.slug}, force_locale=True)
    doc2_delete_link = page.find('#already-spam    a[href="{url}"]'.format(url=doc2_delete_url))
    eq_(len(doc2_delete_link), 1)
