Skip to content

Commit

Permalink
Merge pull request #426 from eclarizio/BZ1601925
Browse files Browse the repository at this point in the history
Ensure 'submit_workflow' is true when adding a service to a cart
(cherry picked from commit 9d146dc)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1603029
  • Loading branch information
gtanzillo authored and simaishi committed Jul 25, 2018
1 parent 4097aa8 commit da69225
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/api/service_orders_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def service_request_workflow(service_request)
raise BadRequestError, "Must specify a service_template_href for adding a service_request"
end
service_template = resource_search(service_template_id, :service_templates, ServiceTemplate)
service_template.provision_workflow(User.current_user, service_request)
service_template.provision_workflow(User.current_user, service_request, :submit_workflow => true)
end

def check_validation(validation)
Expand Down
12 changes: 12 additions & 0 deletions spec/requests/service_orders_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@
expect(response.parsed_body).to include(expected)
end

it "provisions with workflow with the correct options" do
dialog = FactoryGirl.create(:dialog, :label => "ServiceDialog1")
resource_action = FactoryGirl.create(:resource_action, :action => "Provision", :dialog => dialog)
service_template = FactoryGirl.create(:service_template, :resource_actions => [resource_action])

expect_any_instance_of(ServiceTemplate).to receive(:provision_workflow).with(@user, {}, :submit_workflow => true)

api_basic_authorize collection_action_identifier(:service_orders, :create)

post(api_service_orders_url, :params => { :service_requests => [{ :service_template_href => api_service_template_url(nil, service_template) }] })
end

specify "the default state for a service order is 'cart'" do
api_basic_authorize collection_action_identifier(:service_orders, :create)

Expand Down

0 comments on commit da69225

Please sign in to comment.