Sha256: c7cfed86003f800d92c572039cbffe7b912d31332db2e49691f232f974671272

Contents?: true

Size: 1.23 KB

Versions: 3

Compression:

Stored size: 1.23 KB

Contents

require 'test_helper'
class UserSessionTest < ActiveSupport::TestCase
  
  def setup
    activate_authlogic
    controller.session[:session_id] = "FakeSessionID"
    controller.cookies[:iPlanetDirectoryPro] = { :value => VALID_OPENSSO_FOR_NYU }
  end
  
  test "valid_sso_session?" do
    user_session = UserSession.new
    assert(user_session.valid_sso_session?)
    controller.cookies[:iPlanetDirectoryPro] = { :value => INVALID_OPENSSO }
    user_session = UserSession.new
    assert(!user_session.valid_sso_session?)
  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)
    user_session = UserSession.find
  end
  
  # test "find_new_user" do
  #   controller.cookies[:PDS_HANDLE] = { :value => VALID_PDS_HANDLE_FOR_NEW_NYU }
  #   user_session = UserSession.find
  #   # puts user_session.record.username
  #   # puts user_session.record.id
  # end
  # 
  # test "find_existing_user" do
  #   controller.cookies[:PDS_HANDLE] = { :value => VALID_PDS_HANDLE_FOR_EXISTING_NYU }
  #   user_session = UserSession.find
  #   # puts user_session.record.username
  #   # puts user_session.record.id
  # end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
authpds-nyu-0.0.7 test/unit/user_session_test.rb
authpds-nyu-0.0.6 test/unit/user_session_test.rb
authpds-nyu-0.0.5 test/unit/user_session_test.rb