ldap_plugin_test.rb
1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require 'test_helper'
class LdapPluginTest < ActiveSupport::TestCase
should "not allow user registration" do
plugin = LdapPlugin.new
refute plugin.allow_user_registration
end
should "not allow password recovery" do
plugin = LdapPlugin.new
plugin.context = mock
plugin.context.expects(:environment).returns(Environment.default)
refute plugin.allow_password_recovery
end
should 'return login when exists a login attribute returned by ldap' do
plugin = LdapPlugin.new
assert_equal 'test', plugin.get_login({:uid => 'test'}, 'uid', 'test2')
end
should 'return the attribute configured by attr_login when the attribute exists' do
plugin = LdapPlugin.new
assert_equal 'test', plugin.get_login({:uid => 'test'}, 'uid', 'test2')
end
should 'return login when the ldap attribute does not exists' do
plugin = LdapPlugin.new
assert_equal 'test2', plugin.get_login({:uid => 'test'}, 'mail', 'test2')
end
should 'use the first word at attr_login as the login key' do
plugin = LdapPlugin.new
assert_equal 'test', plugin.get_login({:uid => 'test', :mail => 'test@test'}, 'uid mail', 'test2')
end
end