'Test keywords require permission.'

def test_keywords_require_permission(self):

    doc = self.d
    old_rev = doc.current_revision
    u = UserFactory()
    self.client.login(username=u.username, password='testpass')
    response = self.client.post(reverse('wiki.edit_document', args=[doc.slug]), {'summary': 'A    brief    summary', 'content': 'The    article    content', 'keywords': 'keyword1    keyword2', 'based_on': old_rev.id, 'form': 'rev'})
    eq_(302, response.status_code)
    new_rev = Revision.objects.filter(document=doc).order_by('-id')[0]
    eq_(old_rev.keywords, new_rev.keywords)
    add_permission(u, Revision, 'edit_keywords')
    response = self.client.post(reverse('wiki.edit_document', args=[doc.slug]), {'summary': 'A    brief    summary', 'content': 'The    article    content', 'keywords': 'keyword1    keyword2', 'based_on': old_rev.id, 'form': 'rev'})
    eq_(302, response.status_code)
    new_rev = Revision.objects.filter(document=doc).order_by('-id')[0]
    eq_('keyword1    keyword2', new_rev.keywords)
