Commit 57373c21 authored by jplang's avatar jplang

LdapError is deprecated (#24970).

git-svn-id: https://svn.redmine.org/redmine/trunk@16773 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 2baf0071
...@@ -29,7 +29,7 @@ gem "rbpdf", "~> 1.19.2" ...@@ -29,7 +29,7 @@ gem "rbpdf", "~> 1.19.2"
# Optional gem for LDAP authentication # Optional gem for LDAP authentication
group :ldap do group :ldap do
gem "net-ldap", "~> 0.12.0" gem "net-ldap", "~> 0.16.0"
end end
# Optional gem for OpenID authentication # Optional gem for OpenID authentication
......
...@@ -21,7 +21,7 @@ require 'timeout' ...@@ -21,7 +21,7 @@ require 'timeout'
class AuthSourceLdap < AuthSource class AuthSourceLdap < AuthSource
NETWORK_EXCEPTIONS = [ NETWORK_EXCEPTIONS = [
Net::LDAP::LdapError, Net::LDAP::Error,
Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::ECONNRESET,
Errno::EHOSTDOWN, Errno::EHOSTUNREACH, Errno::EHOSTDOWN, Errno::EHOSTUNREACH,
SocketError SocketError
...@@ -117,7 +117,7 @@ class AuthSourceLdap < AuthSource ...@@ -117,7 +117,7 @@ class AuthSourceLdap < AuthSource
if filter.present? if filter.present?
Net::LDAP::Filter.construct(filter) Net::LDAP::Filter.construct(filter)
end end
rescue Net::LDAP::LdapError, Net::LDAP::FilterSyntaxInvalidError rescue Net::LDAP::Error, Net::LDAP::FilterSyntaxInvalidError
nil nil
end end
......
...@@ -174,7 +174,7 @@ class AuthSourcesControllerTest < Redmine::ControllerTest ...@@ -174,7 +174,7 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
end end
def test_test_connection_with_failure def test_test_connection_with_failure
AuthSourceLdap.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::LdapError.new("Something went wrong")) AuthSourceLdap.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::Error.new("Something went wrong"))
get :test_connection, :params => { get :test_connection, :params => {
:id => 1 :id => 1
......
...@@ -150,7 +150,7 @@ class AuthSourceLdapTest < ActiveSupport::TestCase ...@@ -150,7 +150,7 @@ class AuthSourceLdapTest < ActiveSupport::TestCase
end end
def test_search_with_exception_should_return_an_empty_array def test_search_with_exception_should_return_an_empty_array
Net::LDAP.stubs(:new).raises(Net::LDAP::LdapError, 'Cannot connect') Net::LDAP.stubs(:new).raises(Net::LDAP::Error, 'Cannot connect')
results = AuthSource.search("exa") results = AuthSource.search("exa")
assert_equal [], results assert_equal [], results
...@@ -169,7 +169,7 @@ class AuthSourceLdapTest < ActiveSupport::TestCase ...@@ -169,7 +169,7 @@ class AuthSourceLdapTest < ActiveSupport::TestCase
auth_source.host = "badhost" auth_source.host = "badhost"
auth_source.save! auth_source.save!
assert_raise Net::LDAP::Error do assert_raise AuthSourceException do
auth_source.test_connection auth_source.test_connection
end end
end end
...@@ -179,7 +179,7 @@ class AuthSourceLdapTest < ActiveSupport::TestCase ...@@ -179,7 +179,7 @@ class AuthSourceLdapTest < ActiveSupport::TestCase
auth_source.port = 1234 auth_source.port = 1234
auth_source.save! auth_source.save!
assert_raise Net::LDAP::Error do assert_raise AuthSourceException do
auth_source.test_connection auth_source.test_connection
end end
end end
......
...@@ -661,7 +661,7 @@ class UserTest < ActiveSupport::TestCase ...@@ -661,7 +661,7 @@ class UserTest < ActiveSupport::TestCase
if ldap_configured? if ldap_configured?
test "#try_to_login using LDAP with failed connection to the LDAP server" do test "#try_to_login using LDAP with failed connection to the LDAP server" do
auth_source = AuthSourceLdap.find(1) auth_source = AuthSourceLdap.find(1)
AuthSource.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::LdapError, 'Cannot connect') AuthSource.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::Error, 'Cannot connect')
assert_nil User.try_to_login('edavis', 'wrong') assert_nil User.try_to_login('edavis', 'wrong')
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment