File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
spec/unit/controllers/runtime Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,11 @@ def read
2828
2929 info [ :user ] = user . guid if user
3030
31+ unless @config . get ( :temporary_enable_v2 )
32+ info [ :support ] = 'CF API v2 is disabled'
33+ info [ :api_version ] = ''
34+ end
35+
3136 Oj . dump ( info , mode : :compat )
3237 end
3338 end
Original file line number Diff line number Diff line change @@ -61,6 +61,25 @@ module VCAP::CloudController
6161 expect ( hash [ 'min_recommended_cli_version' ] ) . to eq ( 'min_recommended_cli_version' )
6262 end
6363
64+ it 'returns limited info when cc.temporary_enable_v2 is disabled' do
65+ TestConfig . override ( temporary_enable_v2 : false )
66+
67+ get '/v2/info'
68+ hash = Oj . load ( last_response . body )
69+ expect ( hash [ 'name' ] ) . to eq ( TestConfig . config [ :info ] [ :name ] )
70+ expect ( hash [ 'build' ] ) . to eq ( TestConfig . config [ :info ] [ :build ] )
71+ expect ( hash [ 'support' ] ) . to eq ( 'CF API v2 is disabled' )
72+ expect ( hash [ 'version' ] ) . to eq ( TestConfig . config [ :info ] [ :version ] )
73+ expect ( hash [ 'description' ] ) . to eq ( TestConfig . config [ :info ] [ :description ] )
74+ expect ( hash [ 'authorization_endpoint' ] ) . to eq ( TestConfig . config [ :login ] [ :url ] )
75+ expect ( hash [ 'token_endpoint' ] ) . to eq ( TestConfig . config [ :uaa ] [ :url ] )
76+ expect ( hash [ 'app_ssh_endpoint' ] ) . to eq ( TestConfig . config [ :info ] [ :app_ssh_endpoint ] )
77+ expect ( hash [ 'app_ssh_host_key_fingerprint' ] ) . to eq ( TestConfig . config [ :info ] [ :app_ssh_host_key_fingerprint ] )
78+ expect ( hash [ 'app_ssh_oauth_client' ] ) . to eq ( TestConfig . config [ :info ] [ :app_ssh_oauth_client ] )
79+ expect ( hash [ 'api_version' ] ) . to eq ( '' )
80+ expect ( hash [ 'osbapi_version' ] ) . to eq ( VCAP ::CloudController ::Constants ::OSBAPI_VERSION )
81+ end
82+
6483 describe 'custom fields' do
6584 context 'without custom fields in config' do
6685 before { TestConfig . override ( info : { } ) }
You can’t perform that action at this time.
0 commit comments