summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-07-08 13:46:47 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-07-08 13:46:47 +0000
commit2bc719e2c8deccaedc523ffa6ae2849321fc5cc3 (patch)
tree16d765af721c77e8634973b68cfcbc6dbe97bc0e
parent21e00bfdbf31e18d957127f64f62a841dab84925 (diff)
downloadredmine-2bc719e2c8deccaedc523ffa6ae2849321fc5cc3.tar.gz
redmine-2bc719e2c8deccaedc523ffa6ae2849321fc5cc3.zip
LdapError is deprecated (#24970).
git-svn-id: http://svn.redmine.org/redmine/trunk@16773 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--Gemfile2
-rw-r--r--app/models/auth_source_ldap.rb4
-rw-r--r--test/functional/auth_sources_controller_test.rb2
-rw-r--r--test/unit/auth_source_ldap_test.rb6
-rw-r--r--test/unit/user_test.rb2
5 files changed, 8 insertions, 8 deletions
diff --git a/Gemfile b/Gemfile
index 7ed8f5f1d..33a953d50 100644
--- a/Gemfile
+++ b/Gemfile
@@ -29,7 +29,7 @@ gem "rbpdf", "~> 1.19.2"
# Optional gem for LDAP authentication
group :ldap do
- gem "net-ldap", "~> 0.12.0"
+ gem "net-ldap", "~> 0.16.0"
end
# Optional gem for OpenID authentication
diff --git a/app/models/auth_source_ldap.rb b/app/models/auth_source_ldap.rb
index c3565aa8f..8e380d456 100644
--- a/app/models/auth_source_ldap.rb
+++ b/app/models/auth_source_ldap.rb
@@ -21,7 +21,7 @@ require 'timeout'
class AuthSourceLdap < AuthSource
NETWORK_EXCEPTIONS = [
- Net::LDAP::LdapError,
+ Net::LDAP::Error,
Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::ECONNRESET,
Errno::EHOSTDOWN, Errno::EHOSTUNREACH,
SocketError
@@ -117,7 +117,7 @@ class AuthSourceLdap < AuthSource
if filter.present?
Net::LDAP::Filter.construct(filter)
end
- rescue Net::LDAP::LdapError, Net::LDAP::FilterSyntaxInvalidError
+ rescue Net::LDAP::Error, Net::LDAP::FilterSyntaxInvalidError
nil
end
diff --git a/test/functional/auth_sources_controller_test.rb b/test/functional/auth_sources_controller_test.rb
index 18d5f05cd..e6bfcf54c 100644
--- a/test/functional/auth_sources_controller_test.rb
+++ b/test/functional/auth_sources_controller_test.rb
@@ -174,7 +174,7 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
end
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 => {
:id => 1
diff --git a/test/unit/auth_source_ldap_test.rb b/test/unit/auth_source_ldap_test.rb
index c7676f14c..376fdf730 100644
--- a/test/unit/auth_source_ldap_test.rb
+++ b/test/unit/auth_source_ldap_test.rb
@@ -150,7 +150,7 @@ class AuthSourceLdapTest < ActiveSupport::TestCase
end
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")
assert_equal [], results
@@ -169,7 +169,7 @@ class AuthSourceLdapTest < ActiveSupport::TestCase
auth_source.host = "badhost"
auth_source.save!
- assert_raise Net::LDAP::Error do
+ assert_raise AuthSourceException do
auth_source.test_connection
end
end
@@ -179,7 +179,7 @@ class AuthSourceLdapTest < ActiveSupport::TestCase
auth_source.port = 1234
auth_source.save!
- assert_raise Net::LDAP::Error do
+ assert_raise AuthSourceException do
auth_source.test_connection
end
end
diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb
index 858dc3209..f9678c749 100644
--- a/test/unit/user_test.rb
+++ b/test/unit/user_test.rb
@@ -661,7 +661,7 @@ class UserTest < ActiveSupport::TestCase
if ldap_configured?
test "#try_to_login using LDAP with failed connection to the LDAP server" do
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')
end