1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
# frozen_string_literal: true
# rubocop:todo all
require 'spec_helper'
describe Mongo::Auth::LDAP::Conversation do
let(:user) do
Mongo::Auth::User.new(
database: '$external',
user: 'user',
password: 'pencil'
)
end
let(:conversation) do
described_class.new(user, double('connection'))
end
describe '#start' do
let(:query) do
conversation.start(nil)
end
let(:selector) do
query.selector
end
it 'sets the sasl start flag' do
expect(selector[:saslStart]).to eq(1)
end
it 'sets the auto authorize flag' do
expect(selector[:autoAuthorize]).to eq(1)
end
it 'sets the mechanism' do
expect(selector[:mechanism]).to eq('PLAIN')
end
it 'sets the payload' do
expect(selector[:payload].data).to eq("\x00user\x00pencil")
end
end
end
|