@@ -139,11 +139,14 @@ module VCAP::CloudController::Presenters::V3
139139 allow ( VCAP ::CloudController ::Config ) . to receive_message_chain ( :config , :get ) . with ( :kubernetes , :host_url ) . and_return ( nil )
140140 allow ( VCAP ::CloudController ::Config ) . to receive_message_chain ( :config , :get ) . with ( :external_domain ) . and_return ( 'api2.vcap.me' )
141141 allow ( VCAP ::CloudController ::Config ) . to receive_message_chain ( :config , :get ) . with ( :external_protocol ) . and_return ( 'https' )
142+ allow ( CloudController ::DependencyLocator ) . to receive_message_chain ( :instance , :routing_api_client ) . and_return ( routing_api_client )
143+ allow ( routing_api_client ) . to receive ( :enabled? ) . and_return ( true )
142144 end
143145
146+ let ( :routing_api_client ) { instance_double ( VCAP ::CloudController ::RoutingApi ::Client ) }
144147 let ( :org ) { VCAP ::CloudController ::Organization . make ( guid : 'org' ) }
145148 let ( :domain ) do
146- VCAP ::CloudController ::PrivateDomain . make (
149+ VCAP ::CloudController ::SharedDomain . make (
147150 name : 'my.domain.com' ,
148151 router_group_guid : 'some-router-guid'
149152 )
@@ -175,14 +178,9 @@ module VCAP::CloudController::Presenters::V3
175178 expect ( subject [ :supported_protocols ] ) . to eq ( [ 'tcp' ] )
176179 expect ( subject [ :metadata ] [ :labels ] ) . to eq ( { 'maine.gov/potato' => 'mashed' } )
177180 expect ( subject [ :metadata ] [ :annotations ] ) . to eq ( { 'contacts' => 'Bill tel(1111111) email(bill@fixme), Bob tel(222222) pager(3333333#555) email(bob@fixme)' } )
178- expect ( subject [ :relationships ] [ :organization ] ) . to eq ( {
179- data : { guid : domain . owning_organization . guid }
180- } )
181181 expect ( subject [ :links ] [ :self ] [ :href ] ) . to eq ( "https://api2.vcap.me/v3/domains/#{ domain . guid } " )
182- expect ( subject [ :links ] [ :organization ] [ :href ] ) . to eq ( "https://api2.vcap.me/v3/organizations/#{ domain . owning_organization . guid } " )
183182 expect ( subject [ :links ] [ :route_reservations ] [ :href ] ) . to eq ( "https://api2.vcap.me/v3/domains/#{ domain . guid } /route_reservations" )
184183 expect ( subject [ :links ] [ :router_group ] [ :href ] ) . to eq ( 'https://api2.vcap.me/routing/v1/router_groups/some-router-guid' )
185- expect ( subject [ :links ] [ :shared_organizations ] [ :href ] ) . to eq ( "https://api2.vcap.me/v3/domains/#{ domain . guid } /relationships/shared_organizations" )
186184 end
187185
188186 context 'when the kubernetes host url is blank' do
@@ -205,11 +203,18 @@ module VCAP::CloudController::Presenters::V3
205203 end
206204 end
207205
208- context 'and the routing API is disabled' do
209- let ( :routing_api_client ) { instance_double ( VCAP ::CloudController ::RoutingApi ::Client ) }
206+ context 'when kubernetes is enabled (not using routing API)' do
207+ before do
208+ allow ( VCAP ::CloudController ::Config ) . to receive_message_chain ( :config , :get ) . with ( :kubernetes , :host_url ) . and_return ( 'kube.com' )
209+ end
210+
211+ it 'shows the http protocol' do
212+ expect ( subject [ :supported_protocols ] ) . to eq ( [ 'http' ] )
213+ end
214+ end
210215
216+ context 'and the routing API is disabled' do
211217 before do
212- allow ( VCAP ::CloudController ::RoutingApi ::Client ) . to receive ( :new ) . and_return ( routing_api_client )
213218 allow ( routing_api_client ) . to receive ( :enabled? ) . and_return false
214219 end
215220
0 commit comments