@@ -49,8 +49,8 class AuthSourceLdap < AuthSource | |||||
49 | def test_connection |
|
49 | def test_connection | |
50 | ldap_con = initialize_ldap_con(self.account, self.account_password) |
|
50 | ldap_con = initialize_ldap_con(self.account, self.account_password) | |
51 | ldap_con.open { } |
|
51 | ldap_con.open { } | |
52 |
rescue Net::LDAP::LdapError => |
|
52 | rescue Net::LDAP::LdapError => e | |
53 |
raise "LdapError: " + |
|
53 | raise "LdapError: " + e.message | |
54 | end |
|
54 | end | |
55 |
|
55 | |||
56 | def auth_method_name |
|
56 | def auth_method_name |
@@ -117,11 +117,11 class AuthSourcesControllerTest < ActionController::TestCase | |||||
117 | end |
|
117 | end | |
118 |
|
118 | |||
119 | def test_test_connection_with_failure |
|
119 | def test_test_connection_with_failure | |
120 |
AuthSourceLdap.any_instance.stubs(: |
|
120 | AuthSourceLdap.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::LdapError.new("Something went wrong")) | |
121 |
|
121 | |||
122 | get :test_connection, :id => 1 |
|
122 | get :test_connection, :id => 1 | |
123 | assert_redirected_to '/auth_sources' |
|
123 | assert_redirected_to '/auth_sources' | |
124 | assert_not_nil flash[:error] |
|
124 | assert_not_nil flash[:error] | |
125 |
assert_include ' |
|
125 | assert_include 'Something went wrong', flash[:error] | |
126 | end |
|
126 | end | |
127 | end |
|
127 | end |
General Comments 0
You need to be logged in to leave comments.
Login now