##// END OF EJS Templates
Add some tests for User#try_to_login with LDAP. #5592...
Eric Davis -
r3705:6ef240841cff
parent child
Show More
@@ -156,6 +156,21 class UserTest < ActiveSupport::TestCase
156
156
157 if ldap_configured?
157 if ldap_configured?
158 context "#try_to_login using LDAP" do
158 context "#try_to_login using LDAP" do
159 context "with failed connection to the LDAP server" do
160 should "return nil" do
161 @auth_source = AuthSourceLdap.find(1)
162 AuthSource.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::LdapError, 'Cannot connect')
163
164 assert_equal nil, User.try_to_login('edavis', 'wrong')
165 end
166 end
167
168 context "with an unsuccessful authentication" do
169 should "return nil" do
170 assert_equal nil, User.try_to_login('edavis', 'wrong')
171 end
172 end
173
159 context "on the fly registration" do
174 context "on the fly registration" do
160 setup do
175 setup do
161 @auth_source = AuthSourceLdap.find(1)
176 @auth_source = AuthSourceLdap.find(1)
General Comments 0
You need to be logged in to leave comments. Login now