- disables a test that wont run on most machines

This commit is contained in:
Kaspar Schiess 2010-10-11 08:46:58 +02:00
parent ee58580a53
commit 74e994eed1

View file

@ -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' } # HOST= '10.10.10.71'
BASIC_USER = "cn=jsmith,ou=sales,#{BASE}" # PORT = 389
RENAMED_USER = "cn=jbrown,ou=sales,#{BASE}" # BASE = "o=test"
MOVED_USER = "cn=jsmith,ou=marketing,#{BASE}" # AUTH = { :method => :simple, :username => "cn=testadmin,#{BASE}", :password => 'password' }
RENAMED_MOVED_USER = "cn=jjones,ou=marketing,#{BASE}" # BASIC_USER = "cn=jsmith,ou=sales,#{BASE}"
# RENAMED_USER = "cn=jbrown,ou=sales,#{BASE}"
def setup # MOVED_USER = "cn=jsmith,ou=marketing,#{BASE}"
# create the entries we're going to manipulate # RENAMED_MOVED_USER = "cn=jjones,ou=marketing,#{BASE}"
Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap| #
if ldap.add(:dn => "ou=sales,#{BASE}", :attributes => { :ou => "sales", :objectclass => "organizationalUnit" }) # def setup
puts "Add failed: #{ldap.get_operation_result.message} - code: #{ldap.get_operation_result.code}" # # create the entries we're going to manipulate
end # Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
ldap.add(:dn => "ou=marketing,#{BASE}", :attributes => { :ou => "marketing", :objectclass => "organizationalUnit" }) # if ldap.add(:dn => "ou=sales,#{BASE}", :attributes => { :ou => "sales", :objectclass => "organizationalUnit" })
ldap.add(:dn => BASIC_USER, :attributes => { :cn => "jsmith", :objectclass => "inetOrgPerson", :sn => "Smith" }) # puts "Add failed: #{ldap.get_operation_result.message} - code: #{ldap.get_operation_result.code}"
end # end
end # ldap.add(:dn => "ou=marketing,#{BASE}", :attributes => { :ou => "marketing", :objectclass => "organizationalUnit" })
# ldap.add(:dn => BASIC_USER, :attributes => { :cn => "jsmith", :objectclass => "inetOrgPerson", :sn => "Smith" })
def test_rename_entry # end
dn = nil # end
Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap| #
ldap.rename(:olddn => BASIC_USER, :newrdn => "cn=jbrown") # def test_rename_entry
# dn = nil
ldap.search(:base => RENAMED_USER) do |entry| # Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
dn = entry.dn # ldap.rename(:olddn => BASIC_USER, :newrdn => "cn=jbrown")
end #
end # ldap.search(:base => RENAMED_USER) do |entry|
assert_equal(RENAMED_USER, dn) # dn = entry.dn
end # end
# end
def test_move_entry # assert_equal(RENAMED_USER, dn)
dn = nil # end
Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap| #
ldap.rename(:olddn => BASIC_USER, :newrdn => "cn=jsmith", :new_superior => "ou=marketing,#{BASE}") # def test_move_entry
# dn = nil
ldap.search(:base => MOVED_USER) do |entry| # Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
dn = entry.dn # ldap.rename(:olddn => BASIC_USER, :newrdn => "cn=jsmith", :new_superior => "ou=marketing,#{BASE}")
end #
end # ldap.search(:base => MOVED_USER) do |entry|
assert_equal(MOVED_USER, dn) # dn = entry.dn
end # end
# end
def test_move_and_rename_entry # assert_equal(MOVED_USER, dn)
dn = nil # end
Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap| #
ldap.rename(:olddn => BASIC_USER, :newrdn => "cn=jjones", :new_superior => "ou=marketing,#{BASE}") # def test_move_and_rename_entry
# dn = nil
ldap.search(:base => RENAMED_MOVED_USER) do |entry| # Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
dn = entry.dn # ldap.rename(:olddn => BASIC_USER, :newrdn => "cn=jjones", :new_superior => "ou=marketing,#{BASE}")
end #
end # ldap.search(:base => RENAMED_MOVED_USER) do |entry|
assert_equal(RENAMED_MOVED_USER, dn) # dn = entry.dn
end # end
# end
def teardown # assert_equal(RENAMED_MOVED_USER, dn)
# delete the entries # end
# note: this doesn't always completely clear up on eDirectory as objects get locked while #
# the rename/move is being completed on the server and this prevents the delete from happening # def teardown
Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap| # # delete the entries
ldap.delete(:dn => BASIC_USER) # # note: this doesn't always completely clear up on eDirectory as objects get locked while
ldap.delete(:dn => RENAMED_USER) # # the rename/move is being completed on the server and this prevents the delete from happening
ldap.delete(:dn => MOVED_USER) # Net::LDAP::open(:host => HOST, :port => PORT, :auth => AUTH) do |ldap|
ldap.delete(:dn => RENAMED_MOVED_USER) # ldap.delete(:dn => BASIC_USER)
ldap.delete(:dn => "ou=sales,#{BASE}") # ldap.delete(:dn => RENAMED_USER)
ldap.delete(:dn => "ou=marketing,#{BASE}") # ldap.delete(:dn => MOVED_USER)
end # ldap.delete(:dn => RENAMED_MOVED_USER)
end # ldap.delete(:dn => "ou=sales,#{BASE}")
# ldap.delete(:dn => "ou=marketing,#{BASE}")
# end
# end
end end