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

  def setup
    activate_authlogic
    controller.session[:session_id] = "FakeSessionID"
  end

  test "find" do
    user_session = UserSession.new
    assert_nil(controller.session["authpds_credentials"])
    assert_nil(user_session.send(:attempted_record))
    assert_nil(user_session.record)
    VCR.use_cassette('find') do
      assert_nothing_raised {
        user_session = UserSession.find
      }
    end
  end

  test "logout_url" do
    user_session = UserSession.new
    assert_equal(
      "https://login.library.edu/logout?url=http%3A%2F%2Frailsapp.library.nyu.edu",
        user_session.logout_url)
  end

  test "aleph_bor_auth" do
    user_session = UserSession.new
    VCR.use_cassette('bor_auth') do
      bor_auth = user_session.aleph_bor_auth("DS89D", "TEST", "NYU50", "BOBST")
      assert_equal("89", bor_auth.permissions[:bor_status])
      assert_equal("CB", bor_auth.permissions[:bor_type])
      assert_equal("Y", bor_auth.permissions[:hold_on_shelf])
    end
  end

  test "aleph_bor_auth_permissions" do
    user_session = UserSession.new
    VCR.use_cassette('bor_auth_permissions') do
      permissions = user_session.aleph_bor_auth_permissions("DS89D", "TEST", "NYU50", "BOBST")
      assert_equal("89", permissions[:bor_status])
      assert_equal("CB", permissions[:bor_type])
      assert_equal("Y", permissions[:hold_on_shelf])
    end
  end

  test "invalid user" do
    controller.cookies[:PDS_HANDLE] = { :value => INVALID_PDS_HANDLE }
    VCR.use_cassette('invalid user') do
      assert_nothing_raised do
        user_session = UserSession.find
      end
    end
  end

  test "aleph user" do
    controller.cookies[:PDS_HANDLE] = { :value => ALEPH_PDS_HANDLE }
    VCR.use_cassette('aleph user') do
      assert_nothing_raised do
        user_session = UserSession.find
      end
    end
  end

  test "shibboleth user" do
    controller.cookies[:PDS_HANDLE] = { :value => SHIBBOLETH_PDS_HANDLE }
    VCR.use_cassette('shibboleth user') do
      assert_nothing_raised do
        user_session = UserSession.find
      end
    end
  end
end<commit_msg>Remove unnecessary tests<commit_after>require 'test_helper'
class UserSessionTest < ActiveSupport::TestCase

  def setup
    activate_authlogic
    controller.session[:session_id] = "FakeSessionID"
  end

  test "find" do
    user_session = UserSession.new
    assert_nil(controller.session["authpds_credentials"])
    assert_nil(user_session.send(:attempted_record))
    assert_nil(user_session.record)
    VCR.use_cassette('find') do
      assert_nothing_raised {
        user_session = UserSession.find
      }
    end
  end

  test "logout_url" do
    user_session = UserSession.new
    assert_equal(
      "https://login.library.edu/logout?url=http%3A%2F%2Frailsapp.library.nyu.edu",
        user_session.logout_url)
  end

  test "invalid user" do
    controller.cookies[:PDS_HANDLE] = { :value => INVALID_PDS_HANDLE }
    VCR.use_cassette('invalid user') do
      assert_nothing_raised do
        user_session = UserSession.find
      end
    end
  end

  test "aleph user" do
    controller.cookies[:PDS_HANDLE] = { :value => ALEPH_PDS_HANDLE }
    VCR.use_cassette('aleph user') do
      assert_nothing_raised do
        user_session = UserSession.find
      end
    end
  end

  test "shibboleth user" do
    controller.cookies[:PDS_HANDLE] = { :value => SHIBBOLETH_PDS_HANDLE }
    VCR.use_cassette('shibboleth user') do
      assert_nothing_raised do
        user_session = UserSession.find
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.09675630718048239, 'fraction_numerical': 0.0049902966454117, 'mean_word_length': 3.4764267990074442, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '6855841', 'n_tokens_mistral': 1263, 'n_tokens_neox': 1219, 'n_words': 215}