Project

General

Profile

« Previous | Next » 

Revision 8ffa0b9a

Added by Jan Pazdziora over 10 years ago

fixes #3528 - Populate first name, last name, and email, if available.

View differences:

test/unit/sso/apache_test.rb
# encoding: UTF-8
require 'test_helper'
class ApacheTest < ActiveSupport::TestCase
......
def test_authenticated?
Setting['authorize_login_delegation_auth_source_user_autocreate'] = 'apache'
apache = get_apache_method
apache.controller.request.env[SSO::Apache::CAS_USERNAME] = nil
apache.controller.request.env[SSO::Apache::CAS_USERNAME] = nil
assert !apache.authenticated?
apache.controller.request.env[SSO::Apache::CAS_USERNAME] = 'ares'
assert apache.authenticated?
end
def test_authenticated_passes_attributes
Setting['authorize_login_delegation_auth_source_user_autocreate'] = 'apache'
apache = get_apache_method
apache.controller.request.env[SSO::Apache::CAS_USERNAME] = 'ares'
apache.controller.request.env['REMOTE_USER_EMAIL'] = 'foobar@example.com'
apache.controller.request.env['REMOTE_USER_FIRSTNAME'] = 'Foo'
apache.controller.request.env['REMOTE_USER_LASTNAME'] = 'Bar'
User.expects(:find_or_create_external_user).
with({:login => 'ares', :mail => 'foobar@example.com', :firstname => 'Foo', :lastname => 'Bar'}, 'apache').
returns(true)
assert apache.authenticated?
end
def test_convert_encoding
apache = get_apache_method
assert apache.send(:convert_encoding, 'fó✗@e✗amp✓e.com')
end
def test_authenticate!
apache = get_apache_method
controller = apache.controller

Also available in: Unified diff