'Test user deactivation'

def test_profile_deactivate(self):

    p = UserFactory().profile
    self.client.login(username=self.user.username, password='testpass')
    res = self.client.post(reverse('users.deactivate', locale='en-US'), {'user_id': p.user.id})
    eq_(403, res.status_code)
    add_permission(self.user, Profile, 'deactivate_users')
    res = self.client.post(reverse('users.deactivate', locale='en-US'), {'user_id': p.user.id})
    eq_(302, res.status_code)
    log = Deactivation.objects.get(user_id=p.user_id)
    eq_(log.moderator_id, self.user.id)
    p = Profile.objects.get(user_id=p.user_id)
    assert (not p.user.is_active)
