'Verify the document revisions list view.'

def test_document_revisions_list(self):

    creator = UserFactory()
    d = DocumentFactory()
    ApprovedRevisionFactory(document=d)
    RevisionFactory(summary='a    tweak', content='lorem    ipsum    dolor', keywords='kw1    kw2', document=d, reviewed=None, creator=creator)
    r2 = RevisionFactory(summary='another    tweak', content='lorem    dimsum    dolor', keywords='kw1    kw2', document=d, reviewed=None, creator=creator)
    response = self.client.get(reverse('wiki.document_revisions', args=[d.slug]))
    eq_(200, response.status_code)
    doc = pq(response.content)
    eq_(4, len(doc('#revision-list    li')))
    eq_(0, len(doc('#revision-list    div.status    a')))
    eq_('Unreviewed', doc('#revision-list    li:not(.header)    div.status').first().text())
    reviewer = UserFactory()
    add_permission(reviewer, Revision, 'review_revision')
    self.client.login(username=reviewer.username, password='testpass')
    response = self.client.get(reverse('wiki.document_revisions', args=[d.slug]))
    eq_(200, response.status_code)
    doc = pq(response.content)
    eq_(2, len(doc('#revision-list    div.status    a')))
    eq_('Review', doc('#revision-list    li:not(.header)    div.status').first().text())
    eq_('/en-US/kb/{slug}/edit/{rev_id}'.format(slug=d.slug, rev_id=r2.id), doc('#revision-list    div.edit    a')[0].attrib['href'])
