Fixed that LDAP error is not displayed when testing connection.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9234 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
71e636ff71
commit
a8e392c0e5
|
@ -49,8 +49,8 @@ class AuthSourceLdap < AuthSource
|
||||||
def test_connection
|
def test_connection
|
||||||
ldap_con = initialize_ldap_con(self.account, self.account_password)
|
ldap_con = initialize_ldap_con(self.account, self.account_password)
|
||||||
ldap_con.open { }
|
ldap_con.open { }
|
||||||
rescue Net::LDAP::LdapError => text
|
rescue Net::LDAP::LdapError => e
|
||||||
raise "LdapError: " + text
|
raise "LdapError: " + e.message
|
||||||
end
|
end
|
||||||
|
|
||||||
def auth_method_name
|
def auth_method_name
|
||||||
|
|
|
@ -117,11 +117,11 @@ class AuthSourcesControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_test_connection_with_failure
|
def test_test_connection_with_failure
|
||||||
AuthSourceLdap.any_instance.stubs(:test_connection).raises(Exception.new("Something went wrong"))
|
AuthSourceLdap.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::LdapError.new("Something went wrong"))
|
||||||
|
|
||||||
get :test_connection, :id => 1
|
get :test_connection, :id => 1
|
||||||
assert_redirected_to '/auth_sources'
|
assert_redirected_to '/auth_sources'
|
||||||
assert_not_nil flash[:error]
|
assert_not_nil flash[:error]
|
||||||
assert_include '(Something went wrong)', flash[:error]
|
assert_include 'Something went wrong', flash[:error]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue