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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user