Skip to content

Commit a748ddf

Browse files
author
Jerry Cheung
committed
consolidate search size tests
1 parent 7baeda3 commit a748ddf

File tree

1 file changed

+1
-34
lines changed

1 file changed

+1
-34
lines changed

test/integration/test_search.rb

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -42,40 +42,6 @@ def test_search_constrained_attributes
4242
assert_empty entry[:mail]
4343
end
4444

45-
# http://tools.ietf.org/html/rfc4511#section-4.5.1.4
46-
def test_search_size
47-
entries = @ldap.search(base: "ou=People,dc=rubyldap,dc=com", size: 2)
48-
49-
assert_equal 2, entries.size
50-
end
51-
52-
# See: test_search_size for what *should* work.
53-
#
54-
# This tests the currently broken behavior where searches are reported as
55-
# failed when the size limit has been reached. This is broken since the
56-
# sizeLimit parameter defines how many results to send back, and will result
57-
# in a sizeLimitExceeded result in cases where there are more results than
58-
# returned; not an error case, but also not a result code that is categorized
59-
# as a non-error result (http://tools.ietf.org/html/rfc4511#appendix-A.1).
60-
# The practical choice is to treat sizeLimitExceeded (and timeLimitExceeded)
61-
# as successful search terminating messages.
62-
def test_search_size_broken
63-
entries = []
64-
65-
returned = @ldap.search(base: "ou=People,dc=rubyldap,dc=com", size: 2) do |entry|
66-
entries << entry.dn
67-
end
68-
refute returned
69-
70-
# reported as an "error" of sizeLimitExceeded
71-
result = @ldap.get_operation_result
72-
assert_equal 4, result.code
73-
assert_equal Net::LDAP::ResultStrings[4], result.message
74-
75-
# received the right number of results
76-
assert_equal 2, entries.size
77-
end
78-
7945
def test_search_attributes_only
8046
entry = @ldap.search(base: "uid=user1,ou=People,dc=rubyldap,dc=com", attributes_only: true).first
8147

@@ -96,6 +62,7 @@ def test_search_timeout
9662
assert_equal entries, result
9763
end
9864

65+
# http://tools.ietf.org/html/rfc4511#section-4.5.1.4
9966
def test_search_with_size
10067
entries = []
10168

0 commit comments

Comments
 (0)