Sha256: d0aa0518ecb006a4bc16ba30063191d4e68815235acdab6b6b32a20254c67e6b

Contents?: true

Size: 856 Bytes

Versions: 9

Compression:

Stored size: 856 Bytes

Contents

# 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

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
mongo-2.21.0 spec/mongo/auth/ldap/conversation_spec.rb
mongo-2.20.1 spec/mongo/auth/ldap/conversation_spec.rb
mogno-2.20.0 spec/mongo/auth/ldap/conversation_spec.rb
mogno-1.0.0 spec/mongo/auth/ldap/conversation_spec.rb
mongo-2.20.0 spec/mongo/auth/ldap/conversation_spec.rb
mongo-2.19.3 spec/mongo/auth/ldap/conversation_spec.rb
mongo-2.19.2 spec/mongo/auth/ldap/conversation_spec.rb
mongo-2.19.1 spec/mongo/auth/ldap/conversation_spec.rb
mongo-2.19.0 spec/mongo/auth/ldap/conversation_spec.rb