File: test_add.rb

package info (click to toggle)
ruby-net-ldap 0.12.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 616 kB
  • ctags: 551
  • sloc: ruby: 4,064; sh: 117; makefile: 4
file content (28 lines) | stat: -rw-r--r-- 700 bytes parent folder | download
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
require_relative '../test_helper'

class TestAddIntegration < LDAPIntegrationTestCase
  def setup
    super
    @ldap.authenticate "cn=admin,dc=rubyldap,dc=com", "passworD1"

    @dn = "uid=added-user1,ou=People,dc=rubyldap,dc=com"
  end

  def test_add
    attrs = {
      objectclass: %w(top inetOrgPerson organizationalPerson person),
      uid:  "added-user1",
      cn:   "added-user1",
      sn:   "added-user1",
      mail: "added-user1@rubyldap.com"
    }

    assert @ldap.add(dn: @dn, attributes: attrs), @ldap.get_operation_result.inspect

    assert result = @ldap.search(base: @dn, scope: Net::LDAP::SearchScope_BaseObject).first
  end

  def teardown
    @ldap.delete dn: @dn
  end
end