Skip to content

Commit

Permalink
Merge pull request ManageIQ#439 from bdunne/allow_retirement_requests
Browse files Browse the repository at this point in the history
Allow retirement requests to be created through the api
  • Loading branch information
abellotti authored Aug 3, 2018
2 parents b1c8463 + a95b448 commit cec4600
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions config/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2447,6 +2447,12 @@
:identifier: svc_catalog_provision
- :klass: ServiceReconfigureRequest
:identifier: service_reconfigure
- :klass: OrchestrationStackRetireRequest
:identifier: orchestration_stack_retire
- :klass: ServiceRetireRequest
:identifier: service_retire
- :klass: VmRetireRequest
:identifier: vm_retire
- :name: edit
:identifier: miq_request_edit
- :name: approve
Expand Down
16 changes: 16 additions & 0 deletions spec/requests/requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,22 @@
expect(response).to have_http_status(:ok)
end

context "supported request types" do
Api::ApiConfig.collections.requests.collection_actions.post.detect { |i| i[:name] == "create" }.identifiers.collect do |type|
request_type = MiqRequest::REQUEST_TYPE_TO_MODEL.invert[type.klass.to_sym]
[type.klass, request_type, type.identifier&.to_sym]
end.each do |klass_name, request_type, identifier|
it "#{klass_name}" do
identifier ? api_basic_authorize(identifier) : api_basic_authorize
klass = klass_name.safe_constantize
expect(klass).to receive(:create_request).and_return(klass.new)
post(api_requests_url, :params => gen_request(:create, :options => {:__request_type__ => request_type}))

expect(response).to have_http_status(:ok)
end
end
end

it "succeed immediately with optional data and auto_approve set to true" do
api_basic_authorize :service_reconfigure

Expand Down

0 comments on commit cec4600

Please sign in to comment.