Sha256: 90360d3f83e6946b52d2e31da773be122865c7d38255c28f6d9b15dee702b76f

Contents?: true

Size: 1.73 KB

Versions: 1

Compression:

Stored size: 1.73 KB

Contents

require 'spec_helper'

describe Acs::Ldap::Connector, order: :defined do
  before(:context) do
    @connector = Acs::Ldap::Connector.new({host: '192.168.59.103', port: 49389, base: "dc=adharacs,dc=lan", dn: "cn=admin,dc=adharacs,dc=lan", password: "admin"})
  end

  it "should be possible to create a connector" do
    expect(@connector).not_to be_nil
  end

  it "should be possible to create a connection" do
    expect(@connector.get_connection()).not_to be_nil
  end

  it "should return an error if a connection failed" do
    connector = Acs::Ldap::Connector.new({host: '127.0.0.1', port: 49390, base: "dc=adharacs,dc=lan", dn: "cn=admin,dc=adharacs,dc=lan", password: "admin"})
    expect(connector.get_connection()).to be_nil
  end

  it "should be possible to search without specs" do
    expect(@connector.search()).not_to be_nil
  end

  it "should be possible to add a user" do
    result = @connector.add(
    "uid=1,ou=people,dc=adharacs,dc=lan",
    {
      sn: "john.doe",
      cn: "John Doe",
      givenName: "John Doe",
      mail: "john.doe@adharacs.lan",
      userPassword: "{SSHA}+MBMtUqzkOeH8hI1KVnl+djdqzw0YmU5M2Y5MmQyOTgxMDU1",
      objectClass: [
        "organizationalPerson",
        "person",
        "top",
        "extensibleObject"
      ]
    }
    )
    expect(result.success?).to eq true
  end

  it "should be possible to find a user" do
    result = @connector.search_by(
      "ou=people,dc=adharacs,dc=lan",
      'mail',
      'john.doe@adharacs.lan',
      'mail'
    )
    expect(result.success?).to eq true
    expect(result.data.length).to eq 1
  end

  it "should be possible to remove a user" do
    result = @connector.delete(
    "uid=1,ou=people,dc=adharacs,dc=lan"
    )
    expect(result.success?).to eq true
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acs-ldap-0.2.2 spec/acs/ldap/connector_spec.rb