summaryrefslogtreecommitdiffstats
path: root/test/functional/auth_sources_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-12-26 11:23:53 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-12-26 11:23:53 +0000
commit7b8ebb7e3ffc62e28396fadbd009216eb0e53c5f (patch)
tree43269790cccebe4e886064e897b9cb0d59edb31b /test/functional/auth_sources_controller_test.rb
parenteba4efc9d0ad6222818a32a5bac2190cef0d45b0 (diff)
downloadredmine-7b8ebb7e3ffc62e28396fadbd009216eb0e53c5f.tar.gz
redmine-7b8ebb7e3ffc62e28396fadbd009216eb0e53c5f.zip
Auto-populate fields while creating a new user with LDAP (#10286).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11080 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/auth_sources_controller_test.rb')
-rw-r--r--test/functional/auth_sources_controller_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/functional/auth_sources_controller_test.rb b/test/functional/auth_sources_controller_test.rb
index c64dca66d..c025db602 100644
--- a/test/functional/auth_sources_controller_test.rb
+++ b/test/functional/auth_sources_controller_test.rb
@@ -149,4 +149,20 @@ class AuthSourcesControllerTest < ActionController::TestCase
assert_not_nil flash[:error]
assert_include 'Something went wrong', flash[:error]
end
+
+ def test_autocomplete_for_new_user
+ AuthSource.expects(:search).with('foo').returns([
+ {:login => 'foo1', :firstname => 'John', :lastname => 'Smith', :mail => 'foo1@example.net', :auth_source_id => 1},
+ {:login => 'Smith', :firstname => 'John', :lastname => 'Doe', :mail => 'foo2@example.net', :auth_source_id => 1}
+ ])
+
+ get :autocomplete_for_new_user, :term => 'foo'
+ assert_response :success
+ assert_equal 'application/json', response.content_type
+ json = ActiveSupport::JSON.decode(response.body)
+ assert_kind_of Array, json
+ assert_equal 2, json.size
+ assert_equal 'foo1', json.first['value']
+ assert_equal 'foo1 (John Smith)', json.first['label']
+ end
end