|
|
@@ -93,4 +93,22 @@ class LdapAuthSourcesControllerTest < ActionController::TestCase |
|
|
|
post :destroy, :id => 1 |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
def test_test_connection |
|
|
|
AuthSourceLdap.any_instance.stubs(:test_connection).returns(true) |
|
|
|
|
|
|
|
get :test_connection, :id => 1 |
|
|
|
assert_redirected_to '/ldap_auth_sources' |
|
|
|
assert_not_nil flash[:notice] |
|
|
|
assert_match /successful/i, flash[:notice] |
|
|
|
end |
|
|
|
|
|
|
|
def test_test_connection_with_failure |
|
|
|
AuthSourceLdap.any_instance.stubs(:test_connection).raises(Exception.new("Something went wrong")) |
|
|
|
|
|
|
|
get :test_connection, :id => 1 |
|
|
|
assert_redirected_to '/ldap_auth_sources' |
|
|
|
assert_not_nil flash[:error] |
|
|
|
assert_include '(Something went wrong)', flash[:error] |
|
|
|
end |
|
|
|
end |