- disables a test that wont run on most machines
This commit is contained in:
parent
ee58580a53
commit
74e994eed1
|
@ -1,73 +1,76 @@
|
||||||
require 'common'
|
require 'common'
|
||||||
|
|
||||||
class TestRename < Test::Unit::TestCase
|
class TestRename < Test::Unit::TestCase
|
||||||
HOST= '10.10.10.71'
|
# Commented out since it assumes you have a live LDAP server somewhere. This
|
||||||
PORT = 389
|
# will be migrated to the integration specs, as soon as they are ready.
|
||||||
BASE = "o=test"
|
|
||||||
AUTH = { :method => :simple, :username => "cn=testadmin,#{BASE}", :password => 'password' }
|
|
||||||
BASIC_USER = "cn=jsmith,ou=sales,#{BASE}"
|
|
||||||
RENAMED_USER = "cn=jbrown,ou=sales,#{BASE}"
|
|
||||||
MOVED_USER = "cn=jsmith,ou=marketing,#{BASE}"
|
|
||||||
RENAMED_MOVED_USER = "cn=jjones,ou=marketing,#{BASE}"
|
|
||||||
|
|
||||||
def setup
|
# HOST= '10.10.10.71'
|
||||||
# create the entries we're going to manipulate
|
# PORT = 389
|
||||||
Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
|
# BASE = "o=test"
|
||||||
if ldap.add(:dn => "ou=sales,#{BASE}", :attributes => { :ou => "sales", :objectclass => "organizationalUnit" })
|
# AUTH = { :method => :simple, :username => "cn=testadmin,#{BASE}", :password => 'password' }
|
||||||
puts "Add failed: #{ldap.get_operation_result.message} - code: #{ldap.get_operation_result.code}"
|
# BASIC_USER = "cn=jsmith,ou=sales,#{BASE}"
|
||||||
end
|
# RENAMED_USER = "cn=jbrown,ou=sales,#{BASE}"
|
||||||
ldap.add(:dn => "ou=marketing,#{BASE}", :attributes => { :ou => "marketing", :objectclass => "organizationalUnit" })
|
# MOVED_USER = "cn=jsmith,ou=marketing,#{BASE}"
|
||||||
ldap.add(:dn => BASIC_USER, :attributes => { :cn => "jsmith", :objectclass => "inetOrgPerson", :sn => "Smith" })
|
# RENAMED_MOVED_USER = "cn=jjones,ou=marketing,#{BASE}"
|
||||||
end
|
#
|
||||||
end
|
# def setup
|
||||||
|
# # create the entries we're going to manipulate
|
||||||
def test_rename_entry
|
# Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
|
||||||
dn = nil
|
# if ldap.add(:dn => "ou=sales,#{BASE}", :attributes => { :ou => "sales", :objectclass => "organizationalUnit" })
|
||||||
Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
|
# puts "Add failed: #{ldap.get_operation_result.message} - code: #{ldap.get_operation_result.code}"
|
||||||
ldap.rename(:olddn => BASIC_USER, :newrdn => "cn=jbrown")
|
# end
|
||||||
|
# ldap.add(:dn => "ou=marketing,#{BASE}", :attributes => { :ou => "marketing", :objectclass => "organizationalUnit" })
|
||||||
ldap.search(:base => RENAMED_USER) do |entry|
|
# ldap.add(:dn => BASIC_USER, :attributes => { :cn => "jsmith", :objectclass => "inetOrgPerson", :sn => "Smith" })
|
||||||
dn = entry.dn
|
# end
|
||||||
end
|
# end
|
||||||
end
|
#
|
||||||
assert_equal(RENAMED_USER, dn)
|
# def test_rename_entry
|
||||||
end
|
# dn = nil
|
||||||
|
# Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
|
||||||
def test_move_entry
|
# ldap.rename(:olddn => BASIC_USER, :newrdn => "cn=jbrown")
|
||||||
dn = nil
|
#
|
||||||
Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
|
# ldap.search(:base => RENAMED_USER) do |entry|
|
||||||
ldap.rename(:olddn => BASIC_USER, :newrdn => "cn=jsmith", :new_superior => "ou=marketing,#{BASE}")
|
# dn = entry.dn
|
||||||
|
# end
|
||||||
ldap.search(:base => MOVED_USER) do |entry|
|
# end
|
||||||
dn = entry.dn
|
# assert_equal(RENAMED_USER, dn)
|
||||||
end
|
# end
|
||||||
end
|
#
|
||||||
assert_equal(MOVED_USER, dn)
|
# def test_move_entry
|
||||||
end
|
# dn = nil
|
||||||
|
# Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
|
||||||
def test_move_and_rename_entry
|
# ldap.rename(:olddn => BASIC_USER, :newrdn => "cn=jsmith", :new_superior => "ou=marketing,#{BASE}")
|
||||||
dn = nil
|
#
|
||||||
Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
|
# ldap.search(:base => MOVED_USER) do |entry|
|
||||||
ldap.rename(:olddn => BASIC_USER, :newrdn => "cn=jjones", :new_superior => "ou=marketing,#{BASE}")
|
# dn = entry.dn
|
||||||
|
# end
|
||||||
ldap.search(:base => RENAMED_MOVED_USER) do |entry|
|
# end
|
||||||
dn = entry.dn
|
# assert_equal(MOVED_USER, dn)
|
||||||
end
|
# end
|
||||||
end
|
#
|
||||||
assert_equal(RENAMED_MOVED_USER, dn)
|
# def test_move_and_rename_entry
|
||||||
end
|
# dn = nil
|
||||||
|
# Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
|
||||||
def teardown
|
# ldap.rename(:olddn => BASIC_USER, :newrdn => "cn=jjones", :new_superior => "ou=marketing,#{BASE}")
|
||||||
# delete the entries
|
#
|
||||||
# note: this doesn't always completely clear up on eDirectory as objects get locked while
|
# ldap.search(:base => RENAMED_MOVED_USER) do |entry|
|
||||||
# the rename/move is being completed on the server and this prevents the delete from happening
|
# dn = entry.dn
|
||||||
Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
|
# end
|
||||||
ldap.delete(:dn => BASIC_USER)
|
# end
|
||||||
ldap.delete(:dn => RENAMED_USER)
|
# assert_equal(RENAMED_MOVED_USER, dn)
|
||||||
ldap.delete(:dn => MOVED_USER)
|
# end
|
||||||
ldap.delete(:dn => RENAMED_MOVED_USER)
|
#
|
||||||
ldap.delete(:dn => "ou=sales,#{BASE}")
|
# def teardown
|
||||||
ldap.delete(:dn => "ou=marketing,#{BASE}")
|
# # delete the entries
|
||||||
end
|
# # note: this doesn't always completely clear up on eDirectory as objects get locked while
|
||||||
end
|
# # the rename/move is being completed on the server and this prevents the delete from happening
|
||||||
|
# Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
|
||||||
|
# ldap.delete(:dn => BASIC_USER)
|
||||||
|
# ldap.delete(:dn => RENAMED_USER)
|
||||||
|
# ldap.delete(:dn => MOVED_USER)
|
||||||
|
# ldap.delete(:dn => RENAMED_MOVED_USER)
|
||||||
|
# ldap.delete(:dn => "ou=sales,#{BASE}")
|
||||||
|
# ldap.delete(:dn => "ou=marketing,#{BASE}")
|
||||||
|
# end
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue