Skip to content

Commit 74e994e

Browse files
committed
- disables a test that wont run on most machines
1 parent ee58580 commit 74e994e

File tree

1 file changed

+72
-69
lines changed

1 file changed

+72
-69
lines changed

test/test_rename.rb

Lines changed: 72 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,76 @@
11
require 'common'
22

33
class TestRename < Test::Unit::TestCase
4-
HOST= '10.10.10.71'
5-
PORT = 389
6-
BASE = "o=test"
7-
AUTH = { :method => :simple, :username => "cn=testadmin,#{BASE}", :password => 'password' }
8-
BASIC_USER = "cn=jsmith,ou=sales,#{BASE}"
9-
RENAMED_USER = "cn=jbrown,ou=sales,#{BASE}"
10-
MOVED_USER = "cn=jsmith,ou=marketing,#{BASE}"
11-
RENAMED_MOVED_USER = "cn=jjones,ou=marketing,#{BASE}"
12-
13-
def setup
14-
# create the entries we're going to manipulate
15-
Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
16-
if ldap.add(:dn => "ou=sales,#{BASE}", :attributes => { :ou => "sales", :objectclass => "organizationalUnit" })
17-
puts "Add failed: #{ldap.get_operation_result.message} - code: #{ldap.get_operation_result.code}"
18-
end
19-
ldap.add(:dn => "ou=marketing,#{BASE}", :attributes => { :ou => "marketing", :objectclass => "organizationalUnit" })
20-
ldap.add(:dn => BASIC_USER, :attributes => { :cn => "jsmith", :objectclass => "inetOrgPerson", :sn => "Smith" })
21-
end
22-
end
23-
24-
def test_rename_entry
25-
dn = nil
26-
Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
27-
ldap.rename(:olddn => BASIC_USER, :newrdn => "cn=jbrown")
28-
29-
ldap.search(:base => RENAMED_USER) do |entry|
30-
dn = entry.dn
31-
end
32-
end
33-
assert_equal(RENAMED_USER, dn)
34-
end
35-
36-
def test_move_entry
37-
dn = nil
38-
Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
39-
ldap.rename(:olddn => BASIC_USER, :newrdn => "cn=jsmith", :new_superior => "ou=marketing,#{BASE}")
40-
41-
ldap.search(:base => MOVED_USER) do |entry|
42-
dn = entry.dn
43-
end
44-
end
45-
assert_equal(MOVED_USER, dn)
46-
end
47-
48-
def test_move_and_rename_entry
49-
dn = nil
50-
Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
51-
ldap.rename(:olddn => BASIC_USER, :newrdn => "cn=jjones", :new_superior => "ou=marketing,#{BASE}")
52-
53-
ldap.search(:base => RENAMED_MOVED_USER) do |entry|
54-
dn = entry.dn
55-
end
56-
end
57-
assert_equal(RENAMED_MOVED_USER, dn)
58-
end
59-
60-
def teardown
61-
# delete the entries
62-
# note: this doesn't always completely clear up on eDirectory as objects get locked while
63-
# the rename/move is being completed on the server and this prevents the delete from happening
64-
Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
65-
ldap.delete(:dn => BASIC_USER)
66-
ldap.delete(:dn => RENAMED_USER)
67-
ldap.delete(:dn => MOVED_USER)
68-
ldap.delete(:dn => RENAMED_MOVED_USER)
69-
ldap.delete(:dn => "ou=sales,#{BASE}")
70-
ldap.delete(:dn => "ou=marketing,#{BASE}")
71-
end
72-
end
4+
# Commented out since it assumes you have a live LDAP server somewhere. This
5+
# will be migrated to the integration specs, as soon as they are ready.
6+
7+
# HOST= '10.10.10.71'
8+
# PORT = 389
9+
# BASE = "o=test"
10+
# AUTH = { :method => :simple, :username => "cn=testadmin,#{BASE}", :password => 'password' }
11+
# BASIC_USER = "cn=jsmith,ou=sales,#{BASE}"
12+
# RENAMED_USER = "cn=jbrown,ou=sales,#{BASE}"
13+
# MOVED_USER = "cn=jsmith,ou=marketing,#{BASE}"
14+
# RENAMED_MOVED_USER = "cn=jjones,ou=marketing,#{BASE}"
15+
#
16+
# def setup
17+
# # create the entries we're going to manipulate
18+
# Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
19+
# if ldap.add(:dn => "ou=sales,#{BASE}", :attributes => { :ou => "sales", :objectclass => "organizationalUnit" })
20+
# puts "Add failed: #{ldap.get_operation_result.message} - code: #{ldap.get_operation_result.code}"
21+
# end
22+
# ldap.add(:dn => "ou=marketing,#{BASE}", :attributes => { :ou => "marketing", :objectclass => "organizationalUnit" })
23+
# ldap.add(:dn => BASIC_USER, :attributes => { :cn => "jsmith", :objectclass => "inetOrgPerson", :sn => "Smith" })
24+
# end
25+
# end
26+
#
27+
# def test_rename_entry
28+
# dn = nil
29+
# Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
30+
# ldap.rename(:olddn => BASIC_USER, :newrdn => "cn=jbrown")
31+
#
32+
# ldap.search(:base => RENAMED_USER) do |entry|
33+
# dn = entry.dn
34+
# end
35+
# end
36+
# assert_equal(RENAMED_USER, dn)
37+
# end
38+
#
39+
# def test_move_entry
40+
# dn = nil
41+
# Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
42+
# ldap.rename(:olddn => BASIC_USER, :newrdn => "cn=jsmith", :new_superior => "ou=marketing,#{BASE}")
43+
#
44+
# ldap.search(:base => MOVED_USER) do |entry|
45+
# dn = entry.dn
46+
# end
47+
# end
48+
# assert_equal(MOVED_USER, dn)
49+
# end
50+
#
51+
# def test_move_and_rename_entry
52+
# dn = nil
53+
# Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
54+
# ldap.rename(:olddn => BASIC_USER, :newrdn => "cn=jjones", :new_superior => "ou=marketing,#{BASE}")
55+
#
56+
# ldap.search(:base => RENAMED_MOVED_USER) do |entry|
57+
# dn = entry.dn
58+
# end
59+
# end
60+
# assert_equal(RENAMED_MOVED_USER, dn)
61+
# end
62+
#
63+
# def teardown
64+
# # delete the entries
65+
# # note: this doesn't always completely clear up on eDirectory as objects get locked while
66+
# # the rename/move is being completed on the server and this prevents the delete from happening
67+
# Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
68+
# ldap.delete(:dn => BASIC_USER)
69+
# ldap.delete(:dn => RENAMED_USER)
70+
# ldap.delete(:dn => MOVED_USER)
71+
# ldap.delete(:dn => RENAMED_MOVED_USER)
72+
# ldap.delete(:dn => "ou=sales,#{BASE}")
73+
# ldap.delete(:dn => "ou=marketing,#{BASE}")
74+
# end
75+
# end
7376
end

0 commit comments

Comments
 (0)