Add some tests for User#try_to_login with LDAP. #5592
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3819 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
bc3ad9af38
commit
6ef240841c
|
@ -156,6 +156,21 @@ class UserTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
if ldap_configured?
|
if ldap_configured?
|
||||||
context "#try_to_login using LDAP" do
|
context "#try_to_login using LDAP" do
|
||||||
|
context "with failed connection to the LDAP server" do
|
||||||
|
should "return nil" do
|
||||||
|
@auth_source = AuthSourceLdap.find(1)
|
||||||
|
AuthSource.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::LdapError, 'Cannot connect')
|
||||||
|
|
||||||
|
assert_equal nil, User.try_to_login('edavis', 'wrong')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with an unsuccessful authentication" do
|
||||||
|
should "return nil" do
|
||||||
|
assert_equal nil, User.try_to_login('edavis', 'wrong')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "on the fly registration" do
|
context "on the fly registration" do
|
||||||
setup do
|
setup do
|
||||||
@auth_source = AuthSourceLdap.find(1)
|
@auth_source = AuthSourceLdap.find(1)
|
||||||
|
|
Loading…
Reference in New Issue