diff --git a/config/api.yml b/config/api.yml index a7c36fd8574..de00a43ee4e 100644 --- a/config/api.yml +++ b/config/api.yml @@ -233,7 +233,7 @@ :options: - :collection - :subcollection - :verbs: *gpd + :verbs: *gpppd :klass: Authentication :collection_actions: :get: @@ -594,7 +594,7 @@ :description: Configuration Script Source :options: - :collection - :verbs: *gpd + :verbs: *gpppd :klass: ConfigurationScriptSource :collection_actions: :get: diff --git a/spec/requests/api/authentications_spec.rb b/spec/requests/api/authentications_spec.rb index eadeb984900..eb88fa82b62 100644 --- a/spec/requests/api/authentications_spec.rb +++ b/spec/requests/api/authentications_spec.rb @@ -178,6 +178,53 @@ end end + describe 'PUT /api/authentications/:id' do + let(:params) do + { + :description => 'Description', + :name => 'Updated Credential' + } + end + + it 'can update an authentication with an appropriate role' do + api_basic_authorize collection_action_identifier(:authentications, :edit) + + run_put(authentications_url(auth.id), :resource => params) + + expected = { + 'success' => true, + 'message' => a_string_including('Updating Authentication'), + 'task_id' => a_kind_of(Numeric) + } + expect(response).to have_http_status(:ok) + expect(response.parsed_body).to include(expected) + end + end + + describe 'PATCH /api/authentications/:id' do + let(:params) do + { + :action => 'edit', + :description => 'Description', + :name => 'Updated Credential' + } + end + + it 'can update an authentication with an appropriate role' do + api_basic_authorize collection_action_identifier(:authentications, :edit) + + run_patch(authentications_url(auth.id), [params]) + + expected = { + 'success' => true, + 'message' => a_string_including('Updating Authentication'), + 'task_id' => a_kind_of(Numeric) + } + expect(response).to have_http_status(:ok) + expect(response.parsed_body).to include(expected) + end + end + describe 'POST /api/authentications/:id' do let(:params) do { diff --git a/spec/requests/api/configuration_script_sources_spec.rb b/spec/requests/api/configuration_script_sources_spec.rb index ebaaef1a9e0..6f1e2b53158 100644 --- a/spec/requests/api/configuration_script_sources_spec.rb +++ b/spec/requests/api/configuration_script_sources_spec.rb @@ -128,6 +128,53 @@ end end + describe 'PUT /api/configuration_script_sources/:id' do + let(:params) do + { + :name => 'foo', + :description => 'bar' + } + end + + it 'updates a configuration_script_source with an appropriate role' do + api_basic_authorize action_identifier(:configuration_script_sources, :edit) + + run_put(configuration_script_sources_url(config_script_src.id), :resource => params) + + expected = { + 'success' => true, + 'message' => a_string_including('Updating ConfigurationScriptSource'), + 'task_id' => a_kind_of(Numeric) + } + expect(response).to have_http_status(:ok) + expect(response.parsed_body).to include(expected) + end + end + + describe 'PATCH /api/configuration_script_sources/:id' do + let(:params) do + { + :action => 'edit', + :name => 'foo', + :description => 'bar' + } + end + + it 'updates a configuration_script_source with an appropriate role' do + api_basic_authorize action_identifier(:configuration_script_sources, :edit) + + run_patch(configuration_script_sources_url(config_script_src.id), [params]) + + expected = { + 'success' => true, + 'message' => a_string_including('Updating ConfigurationScriptSource'), + 'task_id' => a_kind_of(Numeric) + } + expect(response).to have_http_status(:ok) + expect(response.parsed_body).to include(expected) + end + end + describe 'POST /api/configuration_script_sources/:id' do let(:params) do {