<commit_before>require 'test_helper'
class ApplicationControllerTest < ActiveSupport::TestCase

  def setup
    activate_authlogic
    controller.session[:session_id] = "FakeSessionID"
    Institutions.send(:instance_variable_set, :@loadpaths, nil)
    Institutions.send(:instance_variable_set, :@institutions, nil)
    controller.instance_variable_set(:@current_primary_institution, nil)
  end

  test "current_user_session_nil" do
    flunk
    assert_nil(controller.current_user_session)
  end

  test "current_user_session" do
    assert_nil(controller.current_user_session)
    controller.cookies[:PDS_HANDLE] = { :value => VALID_PDS_HANDLE_FOR_NYU }
    VCR.use_cassette('nyu') do
      user_session = controller.current_user_session
      assert_not_nil(user_session)
    end
  end

  test "current_user_nil" do
    assert_nil(controller.current_user)
  end

  test "current_user" do
    assert_nil(controller.current_user)
    controller.cookies[:PDS_HANDLE] = { :value => VALID_PDS_HANDLE_FOR_NYU }
    VCR.use_cassette('nyu') do
      user = controller.current_user
      assert_not_nil(user)
      assert_equal("N12162279", user.username)
    end
  end<commit_msg>Pass tests.<commit_after>require 'test_helper'
class ApplicationControllerTest < ActiveSupport::TestCase

  def setup
    activate_authlogic
    controller.session[:session_id] = "FakeSessionID"
    Institutions.send(:instance_variable_set, :@loadpaths, nil)
    Institutions.send(:instance_variable_set, :@institutions, nil)
    controller.instance_variable_set(:@current_primary_institution, nil)
  end

  test "current_user_session_nil" do
    assert_nil(controller.current_user_session)
  end

  test "current_user_session" do
    assert_nil(controller.current_user_session)
    controller.cookies[:PDS_HANDLE] = { :value => VALID_PDS_HANDLE_FOR_NYU }
    VCR.use_cassette('nyu') do
      user_session = controller.current_user_session
      assert_not_nil(user_session)
    end
  end

  test "current_user_nil" do
    assert_nil(controller.current_user)
  end

  test "current_user" do
    assert_nil(controller.current_user)
    controller.cookies[:PDS_HANDLE] = { :value => VALID_PDS_HANDLE_FOR_NYU }
    VCR.use_cassette('nyu') do
      user = controller.current_user
      assert_not_nil(user)
      assert_equal("N12162279", user.username)
    end
  end
{'fraction_non_alphanumeric': 0.08682634730538923, 'fraction_numerical': 0.006843455945252352, 'mean_word_length': 4.732843137254902, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1984840', 'n_tokens_mistral': 782, 'n_tokens_neox': 765, 'n_words': 119}