Project

General

Profile

Feature #33345 » 33345-v2.patch

Go MAEDA, 2021-10-15 02:58

View differences:

app/models/auth_source_ldap.rb
end
end
rescue *NETWORK_EXCEPTIONS => e
raise AuthSourceException.new(e.message)
raise AuthSourceException.new("#{auth_method_name}: #{e.message}")
end
# Test the connection to the LDAP
......
end
end
rescue *NETWORK_EXCEPTIONS => e
raise AuthSourceException.new(e.message)
raise AuthSourceException.new("#{auth_method_name}: #{e.message}")
end
def auth_method_name
......
end
results
rescue *NETWORK_EXCEPTIONS => e
raise AuthSourceException.new(e.message)
raise AuthSourceException.new("#{auth_method_name}: #{e.message}")
end
def ldap_mode
......
return yield
end
rescue Timeout::Error => e
raise AuthSourceTimeoutException.new(e.message)
raise AuthSourceTimeoutException.new("#{auth_method_name}: #{e.message}")
end
def ldap_filter
test/unit/auth_source_ldap_test.rb
auth_source.timeout = 1
def auth_source.initialize_ldap_con(*args); sleep(5); end
assert_raise AuthSourceTimeoutException do
error = assert_raise AuthSourceTimeoutException do
auth_source.authenticate 'example1', '123456'
end
assert_match /\ALDAP: /, error.message
end
def test_search_should_return_matching_entries
......
auth_source.host = "badhost"
auth_source.save!
assert_raise AuthSourceException do
error = assert_raise AuthSourceException do
auth_source.test_connection
end
assert_match /\ALDAP: /, error.message
end
def test_test_connection_with_incorrect_port
(4-4/4)