Sha256: e0755f7161a1767cc8fe113b2ef91e60b84af5d5f2e37029c00370e2e21607da

Contents?: true

Size: 817 Bytes

Versions: 9

Compression:

Stored size: 817 Bytes

Contents

require 'spec_helper'

describe Mongo::Auth::LDAP::Conversation do

  let(:user) do
    Mongo::Auth::User.new(
      database: Mongo::Database::ADMIN,
      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 & 1 rubygems

Version Path
mongo-2.13.3 spec/mongo/auth/ldap/conversation_spec.rb
mongo-2.14.1 spec/mongo/auth/ldap/conversation_spec.rb
mongo-2.13.2 spec/mongo/auth/ldap/conversation_spec.rb
mongo-2.14.0 spec/mongo/auth/ldap/conversation_spec.rb
mongo-2.14.0.rc1 spec/mongo/auth/ldap/conversation_spec.rb
mongo-2.13.1 spec/mongo/auth/ldap/conversation_spec.rb
mongo-2.13.0 spec/mongo/auth/ldap/conversation_spec.rb
mongo-2.13.0.rc1 spec/mongo/auth/ldap/conversation_spec.rb
mongo-2.13.0.beta1 spec/mongo/auth/ldap/conversation_spec.rb