'Locking questions with permissions via HTTP POST.'

def test_lock_question_with_permissions_POST(self):

    u = UserFactory()
    add_permission(u, Question, 'lock_question')
    self.client.login(username=u.username, password='testpass')
    q = self.question
    response = post(self.client, 'questions.lock', args=[q.id])
    eq_(200, response.status_code)
    eq_(True, Question.objects.get(pk=q.pk).is_locked)
    assert ('This    thread    was    closed.' in response.content)
    response = post(self.client, 'questions.lock', args=[q.id])
    eq_(200, response.status_code)
    eq_(False, Question.objects.get(pk=q.pk).is_locked)
