Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ownership link for infrastructure templates #1174

Merged
merged 2 commits into from
Apr 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/controllers/application_controller/ci_processing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def get_class_from_controller_param(controller)
Service
when "vm_or_template", "vm_infra", "vm_cloud", "vm"
VmOrTemplate
when "miq_template"
MiqTemplate
end
end

Expand Down
27 changes: 27 additions & 0 deletions spec/controllers/application_controller/ci_processing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -865,4 +865,31 @@
include("Retirement initiated for 1 Service from the %{product} Database" % {:product => I18n.t('product.name')})
end
end

describe MiqTemplateController do
context "#vm_button_operation" do
before do
_guid, @miq_server, @zone = EvmSpecHelper.remote_guid_miq_server_zone
allow(MiqServer).to receive(:my_zone).and_return("default")
controller.instance_variable_set(:@lastaction, "show_list")
end

it "should continue to set ownership for a template" do
controller.request.parameters["controller"] = "miq_template"
allow(controller).to receive(:role_allows?).and_return(true)
allow(controller).to receive(:drop_breadcrumb)
template = FactoryGirl.create(:template,
:ext_management_system => FactoryGirl.create(:ems_openstack_infra),
:storage => FactoryGirl.create(:storage))
controller.instance_variable_set(:@_params,
:miq_grid_checks => template.id.to_s,
:pressed => 'miq_template_set_ownership')
expect(controller).to receive(:javascript_redirect).with(:controller => "miq_template",
:action => 'ownership',
:rec_ids => [template.id],
:escape => false)
controller.send('set_ownership')
end
end
end
end