Revision 7892585d
Added by Sean O'Keeffe over 7 years ago
test/controllers/hosts_controller_test.rb | ||
---|---|---|
end
|
||
end
|
||
|
||
test '#process_hostgroup works on Host subclasses' do
|
||
class Host::Test < Host::Base; end
|
||
user = FactoryGirl.create(:user, :with_mail, :admin => false)
|
||
FactoryGirl.create(:filter, :role => user.roles.first, :permissions => Permission.where(:name => [ 'edit_hosts', 'view_hosts' ]))
|
||
hostgroup = FactoryGirl.create(:hostgroup)
|
||
host = FactoryGirl.create(:host, :type => "Host::Test", :hostgroup => hostgroup)
|
||
host.stubs(:set_hostgroup_defaults)
|
||
host.stubs(:set_compute_attributes)
|
||
host.stubs(:architecture)
|
||
host.stubs(:operatingsystem)
|
||
host.stubs(:environment)
|
||
host.stubs(:domain)
|
||
host.stubs(:subnet)
|
||
host.stubs(:compute_profile)
|
||
host.stubs(:realm)
|
||
attrs = host_attributes(host)
|
||
attrs[:id] = host.id
|
||
attrs[:hostgroup_id] = hostgroup.id
|
||
xhr :put, :process_hostgroup, { :host => attrs }, set_session_user(user)
|
||
assert_response :success
|
||
end
|
||
|
||
test '#compute_resource_selected returns 404 without compute_resource_id' do
|
||
xhr :get, :compute_resource_selected, { :host => {} }, set_session_user
|
||
assert_response :not_found
|
Also available in: Unified diff
Fixes #17683 - Wrong resource type in HG AJAX permission check