Skip to content
Browse files

Add spec to ensure basic information in GW provision request

Change-Id: I6c6b0de40e87132aec2f240b2e435b6b2e1c91ef
  • Loading branch information...
1 parent 6aea65e commit 9a0caba91b6daad998d5a82051380e83d87a713e Harshawardhan Gadgil committed
Showing with 28 additions and 2 deletions.
  1. +28 −2 spec/models/service_instance_spec.rb
View
30 spec/models/service_instance_spec.rb
@@ -37,9 +37,13 @@ module VCAP::CloudController
let(:gw_client) { double(:client) }
let(:token) { Models::ServiceAuthToken.make }
+
let(:service) { Models::Service.make(:label => token.label,
- :provider => token.provider) }
- let(:service_plan) { Models::ServicePlan.make(:service => service) }
+ :provider => token.provider,
+ :version => "1.0") }
+
+ let(:service_plan) { Models::ServicePlan.make(:service => service,
+ :name => "myplan") }
let(:provision_resp) do
VCAP::Services::Api::GatewayHandleResponse.new(
@@ -90,6 +94,28 @@ module VCAP::CloudController
end
}.should raise_error
end
+
+ it "ensure gateway provision request contains specific fields" do
+ VCAP::CloudController::SecurityContext.
+ should_receive(:current_user_email).
+ and_return("a@b.c")
+
+ min_expected_fields_in_gw_provision_request = {
+ :label => "#{token.label}-#{service.version}",
+ :name => "foobar",
+ :email => "a@b.c",
+ :plan => "myplan",
+ :version => "1.0",
+ :user_guid => nil,
+ :provider => token.provider,
+ }
+
+ gw_client.should_receive(:provision).
+ with(hash_including(min_expected_fields_in_gw_provision_request)).
+ and_return(provision_resp)
+
+ instance = Models::ServiceInstance.make(:name => "foobar", :service_plan => service_plan)
+ end
end
context "service deprovisioning" do

0 comments on commit 9a0caba

Please sign in to comment.
Something went wrong with that request. Please try again.