File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,28 @@ def test_read_net_ldap_connection_event
121121 assert_equal read_result , result
122122 end
123123
124+ def test_parse_pdu_net_ldap_connection_event
125+ ber = Net ::BER ::BerIdentifiedArray . new ( [ 0 , "" , "" ] )
126+ ber . ber_identifier = Net ::LDAP ::PDU ::BindResult
127+ read_result = [ 2 , ber ]
128+ @tcp_socket . should_receive ( :read_ber ) . and_return ( read_result )
129+
130+ events = @service . subscribe "parse_pdu.net_ldap_connection"
131+
132+ result = @connection . bind ( method : :anon )
133+ assert result . success? , "should be success"
134+
135+ # a parse_pdu event
136+ payload , result = events . pop
137+ assert payload . has_key? ( :pdu )
138+ assert payload . has_key? ( :app_tag )
139+ assert payload . has_key? ( :message_id )
140+ assert_equal Net ::LDAP ::PDU ::BindResult , payload [ :app_tag ]
141+ assert_equal 2 , payload [ :message_id ]
142+ pdu = payload [ :pdu ]
143+ assert_equal 0 , pdu . result_code
144+ end
145+
124146 def test_bind_net_ldap_connection_event
125147 ber = Net ::BER ::BerIdentifiedArray . new ( [ 0 , "" , "" ] )
126148 ber . ber_identifier = Net ::LDAP ::PDU ::BindResult
You can’t perform that action at this time.
0 commit comments