-
Notifications
You must be signed in to change notification settings - Fork 252
Fix size option for ldap.search method #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2a2bf1a
Fix size option for ldap.search method
dzaporozhets 40bcac3
Fix test for ldap.search return codes
dzaporozhets 75cda5a
Remove unnecessary assert in ldap.search return code test
dzaporozhets 9adc587
Avoid using magic number in ldap.search
dzaporozhets e8e0e28
Avoid magic number in success case of ldap search
dzaporozhets b0bc215
Add additional integration test for ldap.search with result
dzaporozhets f3a2515
Fix test_search_with_size case
dzaporozhets File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,4 +40,21 @@ def test_instrument_search | |
assert_equal [entry], payload[:result] | ||
assert_equal "(uid=user1)", payload[:filter] | ||
end | ||
|
||
def test_instrument_search_with_size | ||
events = @service.subscribe "search.net_ldap" | ||
|
||
flexmock(@connection).should_receive(:bind).and_return(flexmock(:bind_result, :result_code => 0)) | ||
flexmock(@connection).should_receive(:search).with(Hash, Proc). | ||
yields(entry = Net::LDAP::Entry.new("uid=user1,ou=users,dc=example,dc=com")). | ||
and_return(flexmock(:search_result, :success? => true, :result_code => 4)) | ||
|
||
refute_nil @subject.search(:filter => "(uid=user1)", :size => 1) | ||
|
||
payload, result = events.pop | ||
assert_equal [entry], result | ||
assert_equal [entry], payload[:result] | ||
assert_equal "(uid=user1)", payload[:filter] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Include an assertion with the size in the payload. |
||
assert_equal result.size, payload[:size] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👌 perfect! |
||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to use a constant in this case. I didn't see one already defined, though, but I'd be in favor of one (or a few) for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 We can define the constants, and then define
ResultStrings
values in terms of those constants.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, not to contradict @jch, we can worry about this in a followup PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍