'Check that the deactivate button is shown appropriately'

def test_deactivate_button(self):

    u = UserFactory()
    r = self.client.get(reverse('users.profile', args=[u.username]))
    assert ('Deactivate    this    user' not in r.content)
    add_permission(self.u, Profile, 'deactivate_users')
    self.client.login(username=self.u.username, password='testpass')
    r = self.client.get(reverse('users.profile', args=[u.username]))
    assert ('Deactivate    this    user' in r.content)
    u.is_active = False
    u.save()
    r = self.client.get(reverse('users.profile', args=[u.username]))
    assert ('This    user    has    been    deactivated.' in r.content)
    r = self.client.get(reverse('users.profile', args=[self.u.username]))
    assert ('Deactivate    this    user' not in r.content)
