Skip to content

Commit

Permalink
add docs for /v2/service_instances/:guid/service_keys
Browse files Browse the repository at this point in the history
[finishes #118333745]

Signed-off-by: Simon Leung <leungs@us.ibm.com>
  • Loading branch information
ameowlia authored and Simon Leung committed Apr 28, 2016
1 parent ec9c60f commit 8a79066
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion spec/api/api_version_spec.rb
Expand Up @@ -2,7 +2,7 @@
require 'vcap/digester'

describe 'Stable API warning system', api_version_check: true do
API_FOLDER_CHECKSUM = '21949ac557ebccf023d98e80584cf147d89741b8'.freeze
API_FOLDER_CHECKSUM = '7d9429e0100dea410954ef41be55a375318484c9'.freeze

it 'double-checks the version' do
expect(VCAP::CloudController::Constants::API_VERSION).to eq('2.55.0')
Expand Down
20 changes: 20 additions & 0 deletions spec/api/documentation/service_instances_api_spec.rb
Expand Up @@ -245,4 +245,24 @@
expect(parsed_response).to eql({ 'manage' => true })
end
end

get '/v2/service_instances/:guid/service_keys' do
service_key = nil

before do
service_key = VCAP::CloudController::ServiceKey.make(name: 'a-service-key', service_instance: service_instance)
end

example 'Retrieving service keys associated with a service instance' do
client.get "/v2/service_instances/#{service_instance.guid}/service_keys", {}, headers

expect(status).to eq(200)
expect(parsed_response['total_results']).to eq(1)
expect(parsed_response['total_pages']).to eq(1)
expect(parsed_response['resources'][0]['metadata']['guid']).to eq(service_key.guid)
expect(parsed_response['resources'][0]['metadata']['url']).to eq("/v2/service_keys/#{service_key.guid}")
expect(parsed_response['resources'][0]['entity']['name']).to eq("a-service-key")
expect(parsed_response['resources'][0]['entity']['service_instance_guid']).to eq(service_instance.guid)
end
end
end

0 comments on commit 8a79066

Please sign in to comment.