Sha256: f35f4a0e5c9be0c3161fa27dd271a7da603dca21d250c045b14bfea959a2d61b
Contents?: true
Size: 1021 Bytes
Versions: 7
Compression:
Stored size: 1021 Bytes
Contents
# -*- ruby encoding: utf-8 -*- require_relative 'test_helper' class TestSearch < Test::Unit::TestCase class FakeConnection def search(args) OpenStruct.new(:result_code => Net::LDAP::ResultCodeOperationsError, :message => "error", :success? => false) end end def setup @service = MockInstrumentationService.new @connection = Net::LDAP.new :instrumentation_service => @service @connection.instance_variable_set(:@open_connection, FakeConnection.new) end def test_true_result assert_nil @connection.search(:return_result => true) end def test_false_result refute @connection.search(:return_result => false) end def test_no_result assert_nil @connection.search end def test_instrumentation_publishes_event events = @service.subscribe "search.net_ldap" @connection.search(:filter => "test") payload, result = events.pop assert payload.has_key?(:result) assert payload.has_key?(:filter) assert_equal "test", payload[:filter] end end
Version data entries
7 entries across 7 versions & 1 rubygems