This commit is contained in:
pvincent
2026-06-05 11:20:14 +00:00
commit 79d31f61c4
50 changed files with 6127 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
require 'spec_helper'
require 'ldap/server/operation'
describe LDAP::Server::Operation do
let(:server) { double 'server' }
let(:connection) { double "connection", opt: { schema: schema, server: server } }
let(:message_id) { 337 }
subject(:operation) { LDAP::Server::Operation.new connection, message_id }
context 'on search' do
before do
operation.instance_variable_set :@attributes, attributes
operation.instance_variable_set :@rescount, 0
end
context 'with schema and wildcard attribute query' do
let(:schema) do
double('schema').tap do |schema|
allow(schema).to receive(:find_attrtype).and_return nil
allow(schema).to receive(:find_attrtype).with('attr')\
.and_return double 'attr', usage: nil
end
end
let(:attributes) { %w(*) }
describe '#send_SearchResultEntry' do
it 'correctly handles wildcard attribute' do
expect(connection).to receive(:write).twice do |message|
expect(message).to include 'val'
end
operation.send_SearchResultEntry 'o=foo', 'attr' => 'val'
operation.send_SearchResultEntry 'o=bar', 'attr' => 'val'
end
end
end
end
end
View File