Permalink
Browse files

Add method to bind services to cc_ipc gem

Test plan:
- Unit tests pass

Change-Id: Icd481842b25b5fdaeb7700b4c2774657f4f0f0f3
  • Loading branch information...
1 parent 5a9ba90 commit 95bb209bfe8a8b690d1f361ab94824a79c26d5bb mpage committed Oct 20, 2011
@@ -29,6 +29,15 @@ def provision_service(label, name, plan, plan_option=nil)
perform_request(Net::HTTP::Post, '/services/v1/configurations', body_hash)
end
+ def bind_service(name, app_id, binding_options)
+ body_hash = {
+ :service_id => name,
+ :app_id => app_id,
+ :binding_options => binding_options,
+ }
+ perform_request(Net::HTTP::Post, '/services/v1/bindings', body_hash)
+ end
+
def unprovision_service(name)
perform_request(Net::HTTP::Delete, "/services/v1/configurations/#{name}")
end
@@ -48,6 +48,19 @@
end
end
+ describe '#bind_service' do
+ it 'should issue a post request to /services/v1/bindings with the correct request body' do
+ uri = build_uri('/services/v1/bindings')
+ serv_req = {
+ :service_id => 'test',
+ :app_id => 5,
+ :binding_options => {:foo => 'bar'},
+ }
+ stub_request(:post, uri).with(:body => serv_req)
+ @client.bind_service(serv_req[:service_id], serv_req[:app_id], serv_req[:binding_options])
+ end
+ end
+
describe '#unprovision_service' do
it 'should issue a delete request to /services/v1/configurations/:name' do
service_name = "test_service"

0 comments on commit 95bb209

Please sign in to comment.