Skip to content

Commit

Permalink
Merge pull request #1174 from lgalis/fix_ownership_link_for_templates
Browse files Browse the repository at this point in the history
Fix ownership link for infrastructure templates
(cherry picked from commit 6f84921)

https://bugzilla.redhat.com/show_bug.cgi?id=1448071
  • Loading branch information
Dan Clarizio authored and simaishi committed May 4, 2017
1 parent de02e26 commit 2ea5564
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
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

0 comments on commit 2ea5564

Please sign in to comment.