Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable put/patch on configuration script sources and authentications #14381

Merged
merged 1 commit into from
Mar 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
:options:
- :collection
- :subcollection
:verbs: *gpd
:verbs: *gpppd
:klass: Authentication
:collection_actions:
:get:
Expand Down Expand Up @@ -594,7 +594,7 @@
:description: Configuration Script Source
:options:
- :collection
:verbs: *gpd
:verbs: *gpppd
:klass: ConfigurationScriptSource
:collection_actions:
:get:
Expand Down
47 changes: 47 additions & 0 deletions spec/requests/api/authentications_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
47 changes: 47 additions & 0 deletions spec/requests/api/configuration_script_sources_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down