Skip to content

Commit

Permalink
enable put on configuration script sources and authentications
Browse files Browse the repository at this point in the history
tests
  • Loading branch information
Jillian Tullo committed Mar 17, 2017
1 parent ab5f789 commit 52ae8a3
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 2 deletions.
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

0 comments on commit 52ae8a3

Please sign in to comment.