Revision 4e4671ce
Added by Nils Domrose almost 11 years ago
test/unit/auth_source_ldap_test.rb | ||
---|---|---|
assert !@auth_source_ldap.save
|
||
end
|
||
|
||
test "the ldap_filter should not exceed the 255 characters" do
|
||
set_all_required_attributes
|
||
assigns_a_string_of_length_greater_than(255, :ldap_filter=)
|
||
assert !@auth_source_ldap.save
|
||
end
|
||
|
||
test "the attr_login should not exceed the 30 characters" do
|
||
missing(:attr_login=)
|
||
assigns_a_string_of_length_greater_than(30, :attr_login=)
|
||
... | ... | |
assert @auth_source_ldap.save
|
||
end
|
||
|
||
test "invalid ldap_filter fails validation" do
|
||
@auth_source_ldap.ldap_filter = "("
|
||
assert !@auth_source_ldap.valid?
|
||
end
|
||
|
||
test "valid ldap_filter passes validation" do
|
||
missing(:ldap_filter)
|
||
assert @auth_source_ldap.valid?
|
||
|
||
@auth_source_ldap.ldap_filter = ""
|
||
assert @auth_source_ldap.valid?
|
||
|
||
@auth_source_ldap.ldap_filter = " "
|
||
assert @auth_source_ldap.valid?
|
||
|
||
@auth_source_ldap.ldap_filter = "key=value"
|
||
assert @auth_source_ldap.valid?
|
||
end
|
||
|
||
test "should strip the ldap attributes before validate" do
|
||
@auth_source_ldap.attr_login = "following spaces "
|
||
@auth_source_ldap.attr_firstname = "following spaces "
|
Also available in: Unified diff
fixes #863 - added ldap_filter to LDAP auth sources to filter lookups using RFC 2254 filters