Skip to content

Commit

Permalink
Merge pull request #14051 from jntullo/additional_test_service_templates
Browse files Browse the repository at this point in the history
Add additional test to Service Template Create
  • Loading branch information
abellotti authored Feb 24, 2017
2 parents 93597dd + 1a35092 commit a571827
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions spec/requests/api/service_templates_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -333,5 +333,32 @@
expect(response).to have_http_status(:ok)
expect(response.parsed_body).to include(expected)
end

it 'returns a bad request error for an invalid request' do
api_basic_authorize collection_action_identifier(:service_templates, :create)
template = FactoryGirl.create(:orchestration_template)
template_parameters = {
:name => 'Orchestration Template',
:service_type => 'atomic',
:prov_type => 'generic_orchestration',
:display => 'false',
:description => 'a description',
:config_info => {
:template_id => template.id
}
}

expected = {
'error' => a_hash_including(
'kind' => 'bad_request',
'message' => a_string_including('Could not create Service Template')
)
}
expect do
run_post(service_templates_url, template_parameters)
end.to change(ServiceTemplateOrchestration, :count).by(0)
expect(response).to have_http_status(:bad_request)
expect(response.parsed_body).to include(expected)
end
end
end

0 comments on commit a571827

Please sign in to comment.