Project

General

Profile

« Previous | Next » 

Revision 16ce9a7a

Added by Daniel Lobato Garcia about 11 years ago

  • ID 16ce9a7a6580999f7fe729b9652981ce2397b161

fixes #2219 - Hostgroup ownership is hierarchical

View differences:

test/functional/hostgroups_controller_test.rb
get :index, {}, set_session_user.merge(:user => users(:one).id)
assert_response :success
end
test 'owners of a hostgroup up in the hierarchy get ownership of all children' do
User.current = User.first
sample_user = users(:one)
Hostgroup.new(:name => "root").save
Hostgroup.find_by_name("root").users << sample_user
post :create, {"hostgroup" => {"name"=>"first" , "parent_id"=> Hostgroup.find_by_name("root").id}}, set_session_user
post :create, {"hostgroup" => {"name"=>"second", "parent_id"=> Hostgroup.find_by_name("first").id}}, set_session_user
assert_equal sample_user, Hostgroup.find_by_name("first").users.first
assert_equal sample_user, Hostgroup.find_by_name("second").users.first
end
end

Also available in: Unified diff