'Verifies the zulip_login_required decorator blocks deactivated users.'

def test_login_required(self):

    user_profile = self.example_user('hamlet')
    email = user_profile.email
    result = self.client_get('/accounts/accept_terms/')
    self.assertEqual(result.status_code, 302)
    self.login(email)
    result = self.client_get('/accounts/accept_terms/')
    self.assert_in_response('I    agree    to    the', result)
    user_profile.is_active = False
    user_profile.save()
    result = self.client_get('/accounts/accept_terms/')
    self.assertEqual(result.status_code, 302)
    do_reactivate_user(user_profile)
    self.login(email)
    result = self.client_get('/accounts/accept_terms/')
    self.assert_in_response('I    agree    to    the', result)
    user_profile.realm.deactivated = True
    user_profile.realm.save()
    result = self.client_get('/accounts/accept_terms/')
    self.assertEqual(result.status_code, 302)
