|
644 | 644 | describe 'GET /v3/service_route_bindings/:guid' do |
645 | 645 | let(:api_call) { ->(user_headers) { get "/v3/service_route_bindings/#{guid}", nil, user_headers } } |
646 | 646 | let(:route) { VCAP::CloudController::Route.make(space: space) } |
| 647 | + let(:route_binding) do |
| 648 | + VCAP::CloudController::RouteBinding.new.save_with_new_operation( |
| 649 | + { service_instance: service_instance, route: route, route_service_url: route_service_url }, |
| 650 | + { type: 'create', state: 'successful' } |
| 651 | + ) |
| 652 | + end |
| 653 | + let(:guid) { route_binding.guid } |
647 | 654 | let(:expected_body) do |
648 | 655 | expected_json( |
649 | 656 | binding_guid: guid, |
|
654 | 661 | last_operation_state: 'successful', |
655 | 662 | ) |
656 | 663 | end |
| 664 | + |
657 | 665 | let(:expected_codes_and_responses) do |
658 | 666 | Hash.new(code: 404).tap do |h| |
659 | | - h['admin'] = { code: 200, body: expected_body } |
660 | | - h['admin_read_only'] = { code: 200, body: expected_body } |
661 | | - h['global_auditor'] = { code: 200, body: expected_body } |
662 | | - h['space_developer'] = { code: 200, body: expected_body } |
663 | | - h['space_manager'] = { code: 200, body: expected_body } |
664 | | - h['space_auditor'] = { code: 200, body: expected_body } |
665 | | - h['org_manager'] = { code: 200, body: expected_body } |
| 667 | + h['admin'] = { code: 200, response_object: expected_body } |
| 668 | + h['admin_read_only'] = { code: 200, response_object: expected_body } |
| 669 | + h['global_auditor'] = { code: 200, response_object: expected_body } |
| 670 | + h['space_developer'] = { code: 200, response_object: expected_body } |
| 671 | + h['space_manager'] = { code: 200, response_object: expected_body } |
| 672 | + h['space_auditor'] = { code: 200, response_object: expected_body } |
| 673 | + h['org_manager'] = { code: 200, response_object: expected_body } |
666 | 674 | end |
667 | 675 | end |
668 | 676 |
|
669 | 677 | context 'user-provided service instance' do |
670 | 678 | let(:service_instance) { VCAP::CloudController::UserProvidedServiceInstance.make(space: space, route_service_url: route_service_url) } |
671 | | - let(:route_binding) { VCAP::CloudController::RouteBinding.make(service_instance: service_instance, route: route) } |
672 | | - let(:guid) { route_binding.guid } |
673 | 679 |
|
674 | 680 | it_behaves_like 'permissions for single object endpoint', ALL_PERMISSIONS |
675 | 681 | end |
|
678 | 684 | let(:service_offering) { VCAP::CloudController::Service.make(requires: ['route_forwarding']) } |
679 | 685 | let(:service_plan) { VCAP::CloudController::ServicePlan.make(service: service_offering) } |
680 | 686 | let(:service_instance) { VCAP::CloudController::ManagedServiceInstance.make(space: space, service_plan: service_plan) } |
681 | | - let(:route_binding) { VCAP::CloudController::RouteBinding.make(service_instance: service_instance, route: route) } |
682 | | - let(:guid) { route_binding.guid } |
683 | 687 |
|
684 | 688 | it_behaves_like 'permissions for single object endpoint', ALL_PERMISSIONS |
685 | 689 | end |
|
0 commit comments