Skip to content

Commit

Permalink
storage service edit
Browse files Browse the repository at this point in the history
  • Loading branch information
OrGur1987 committed Apr 9, 2023
1 parent f7affb8 commit 06510f2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions app/controllers/api/storage_services_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@ def delete_resource_action(type, id = nil, _data = nil)
{:task_id => storage_service.delete_storage_service_queue(User.current_userid)}
end
end

def edit_resource(type, id, data = {})
api_resource(type, id, "Updating", :supports => :update) do |storage_service|
{:task_id => storage_service.update_storage_service_queue(User.current_userid, data)}
end
end
end
end
4 changes: 3 additions & 1 deletion config/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4237,7 +4237,7 @@
:identifier: storage_service
:options:
- :collection
:verbs: *gpd
:verbs: *gpppd
:klass: StorageService
:subcollections:
:collection_actions:
Expand All @@ -4247,6 +4247,8 @@
:post:
- :name: create
:identifier: storage_service_new
- :name: edit
:identifier: storage_service_edit
- :name: delete
:identifier: storage_service_delete
- :name: refresh
Expand Down
15 changes: 15 additions & 0 deletions spec/requests/storage_services_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,19 @@

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

context 'Storage Services edit action' do
it "PUT /api/storage_services/:id'" do
require 'byebug'
byebug
provider = FactoryBot.create(:ems_autosde, :name => 'Autosde')
storage_service = FactoryBot.create("ManageIQ::Providers::Autosde::StorageManager::StorageService", :name => 'test_service1', :ext_management_system => provider)

api_basic_authorize('storage_service_edit')
put(api_storage_service_url(nil, storage_service))
expect(response.parsed_body["message"]).to include("Updating")
expect(response).to have_http_status(:ok)
end
end

end

0 comments on commit 06510f2

Please sign in to comment.