'Editing an answer with permissions.
The edit link should show up on the Answers page.'

def test_edit_answer_with_permissions(self):

    u = UserFactory()
    add_permission(u, Answer, 'change_answer')
    self.client.login(username=u.username, password='testpass')
    response = get(self.client, 'questions.details', args=[self.question.id])
    doc = pq(response.content)
    eq_(1, len(doc('li.edit')))
    answer = self.question.last_answer
    response = get(self.client, 'questions.edit_answer', args=[self.question.id, answer.id])
    eq_(200, response.status_code)
    content = 'New    content    for    answer'
    response = post(self.client, 'questions.edit_answer', {'content': content}, args=[self.question.id, answer.id])
    eq_(content, Answer.objects.get(pk=answer.id).content)
