File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 13
13
subject do
14
14
Net ::LDAP . new \
15
15
:server => "test.mocked.com" , :port => 636 ,
16
+ :force_no_page => true , # so server capabilities are not queried
16
17
:instrumentation_service => @service
17
18
end
18
19
28
29
result . should be_true
29
30
payload [ :bind ] . should == bind_result
30
31
end
32
+
33
+ it "should instrument search" do
34
+ events = @service . subscribe "search.net_ldap"
35
+
36
+ @connection . should_receive ( :bind ) . and_return ( flexmock ( :bind_result , :result_code => 0 ) )
37
+ @connection . should_receive ( :search ) . with ( Hash , Proc ) .
38
+ yields ( entry = Net ::LDAP ::Entry . new ( "uid=user1,ou=users,dc=example,dc=com" ) ) .
39
+ and_return ( flexmock ( :search_result , :success? => true , :result_code => 0 ) )
40
+
41
+ subject . search ( :filter => "(uid=user1)" ) . should be_true
42
+
43
+ payload , result = events . pop
44
+ result . should == [ entry ]
45
+ payload [ :result ] . should == [ entry ]
46
+ payload [ :filter ] . should == "(uid=user1)"
47
+ end
31
48
end
32
49
end
33
50
end
You can’t perform that action at this time.
0 commit comments