gds-api-adapters 60.1.0 → 61.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +0 -6
- data/lib/gds-api-adapters.rb +3 -3
- data/lib/gds_api.rb +45 -45
- data/lib/gds_api/asset_manager.rb +2 -2
- data/lib/gds_api/base.rb +5 -5
- data/lib/gds_api/calendars.rb +1 -1
- data/lib/gds_api/content_store.rb +3 -3
- data/lib/gds_api/email_alert_api.rb +4 -4
- data/lib/gds_api/imminence.rb +2 -2
- data/lib/gds_api/json_client.rb +19 -19
- data/lib/gds_api/link_checker_api.rb +6 -6
- data/lib/gds_api/local_links_manager.rb +1 -1
- data/lib/gds_api/mapit.rb +6 -6
- data/lib/gds_api/middleware/govuk_header_sniffer.rb +1 -1
- data/lib/gds_api/organisations.rb +1 -1
- data/lib/gds_api/performance_platform/data_in.rb +1 -1
- data/lib/gds_api/performance_platform/data_out.rb +14 -14
- data/lib/gds_api/publishing_api.rb +2 -2
- data/lib/gds_api/publishing_api/special_route_publisher.rb +2 -2
- data/lib/gds_api/publishing_api_v2.rb +8 -8
- data/lib/gds_api/railtie.rb +6 -6
- data/lib/gds_api/response.rb +4 -4
- data/lib/gds_api/router.rb +3 -3
- data/lib/gds_api/rummager.rb +1 -1
- data/lib/gds_api/search.rb +10 -20
- data/lib/gds_api/support.rb +1 -1
- data/lib/gds_api/support_api.rb +1 -1
- data/lib/gds_api/test_helpers/asset_manager.rb +4 -4
- data/lib/gds_api/test_helpers/calendars.rb +13 -13
- data/lib/gds_api/test_helpers/common_responses.rb +3 -3
- data/lib/gds_api/test_helpers/content_item_helpers.rb +2 -2
- data/lib/gds_api/test_helpers/content_store.rb +7 -7
- data/lib/gds_api/test_helpers/email_alert_api.rb +19 -19
- data/lib/gds_api/test_helpers/imminence.rb +3 -3
- data/lib/gds_api/test_helpers/json_client_helper.rb +1 -1
- data/lib/gds_api/test_helpers/licence_application.rb +1 -1
- data/lib/gds_api/test_helpers/link_checker_api.rb +5 -5
- data/lib/gds_api/test_helpers/local_links_manager.rb +14 -14
- data/lib/gds_api/test_helpers/mapit.rb +17 -17
- data/lib/gds_api/test_helpers/organisations.rb +7 -7
- data/lib/gds_api/test_helpers/performance_platform/data_out.rb +13 -13
- data/lib/gds_api/test_helpers/publishing_api.rb +8 -8
- data/lib/gds_api/test_helpers/publishing_api_v2.rb +24 -24
- data/lib/gds_api/test_helpers/router.rb +12 -12
- data/lib/gds_api/test_helpers/rummager.rb +3 -3
- data/lib/gds_api/test_helpers/search.rb +18 -18
- data/lib/gds_api/test_helpers/support.rb +1 -1
- data/lib/gds_api/test_helpers/support_api.rb +8 -8
- data/lib/gds_api/test_helpers/worldwide.rb +6 -6
- data/lib/gds_api/version.rb +1 -1
- data/lib/gds_api/worldwide.rb +1 -1
- metadata +4 -4
| @@ -1,7 +1,7 @@ | |
| 1 | 
            -
            require  | 
| 2 | 
            -
            require  | 
| 3 | 
            -
            require  | 
| 4 | 
            -
            require  | 
| 1 | 
            +
            require "gds_api/test_helpers/json_client_helper"
         | 
| 2 | 
            +
            require "gds_api/test_helpers/content_item_helpers"
         | 
| 3 | 
            +
            require "gds_api/test_helpers/intent_helpers"
         | 
| 4 | 
            +
            require "json"
         | 
| 5 5 |  | 
| 6 6 | 
             
            module GdsApi
         | 
| 7 7 | 
             
              module TestHelpers
         | 
| @@ -9,7 +9,7 @@ module GdsApi | |
| 9 9 | 
             
                  include ContentItemHelpers
         | 
| 10 10 | 
             
                  include IntentHelpers
         | 
| 11 11 |  | 
| 12 | 
            -
                  PUBLISHING_API_ENDPOINT = Plek.current.find( | 
| 12 | 
            +
                  PUBLISHING_API_ENDPOINT = Plek.current.find("publishing-api")
         | 
| 13 13 |  | 
| 14 14 | 
             
                  def stub_publishing_api_unreserve_path(base_path, publishing_app = /.*/)
         | 
| 15 15 | 
             
                    stub_publishing_api_unreserve_path_with_code(base_path, publishing_app, 200)
         | 
| @@ -26,12 +26,12 @@ module GdsApi | |
| 26 26 | 
             
                  def stub_publishing_api_put_intent(base_path, body = intent_for_publishing_api(base_path))
         | 
| 27 27 | 
             
                    url = PUBLISHING_API_ENDPOINT + "/publish-intent" + base_path
         | 
| 28 28 | 
             
                    body = body.to_json unless body.is_a?(String)
         | 
| 29 | 
            -
                    stub_request(:put, url).with(body: body).to_return(status: 200, body:  | 
| 29 | 
            +
                    stub_request(:put, url).with(body: body).to_return(status: 200, body: "{}", headers: { "Content-Type" => "application/json; charset=utf-8" })
         | 
| 30 30 | 
             
                  end
         | 
| 31 31 |  | 
| 32 32 | 
             
                  def stub_publishing_api_destroy_intent(base_path)
         | 
| 33 33 | 
             
                    url = PUBLISHING_API_ENDPOINT + "/publish-intent" + base_path
         | 
| 34 | 
            -
                    stub_request(:delete, url).to_return(status: 200, body:  | 
| 34 | 
            +
                    stub_request(:delete, url).to_return(status: 200, body: "{}", headers: { "Content-Type" => "application/json; charset=utf-8" })
         | 
| 35 35 | 
             
                  end
         | 
| 36 36 |  | 
| 37 37 | 
             
                  def stub_default_publishing_api_put_intent
         | 
| @@ -116,7 +116,7 @@ module GdsApi | |
| 116 116 | 
             
                  def stub_publishing_api_unreserve_path_with_code(base_path, publishing_app, code)
         | 
| 117 117 | 
             
                    url = PUBLISHING_API_ENDPOINT + "/paths" + base_path
         | 
| 118 118 | 
             
                    body = { publishing_app: publishing_app }
         | 
| 119 | 
            -
                    stub_request(:delete, url).with(body: body).to_return(status: code, body:  | 
| 119 | 
            +
                    stub_request(:delete, url).with(body: body).to_return(status: code, body: "{}", headers: { "Content-Type" => "application/json; charset=utf-8" })
         | 
| 120 120 | 
             
                  end
         | 
| 121 121 |  | 
| 122 122 | 
             
                  def values_match_recursively(expected_value, actual_value)
         | 
| @@ -1,7 +1,7 @@ | |
| 1 | 
            -
            require  | 
| 2 | 
            -
            require  | 
| 3 | 
            -
            require  | 
| 4 | 
            -
            require  | 
| 1 | 
            +
            require "gds_api/test_helpers/json_client_helper"
         | 
| 2 | 
            +
            require "gds_api/test_helpers/content_item_helpers"
         | 
| 3 | 
            +
            require "gds_api/test_helpers/intent_helpers"
         | 
| 4 | 
            +
            require "json"
         | 
| 5 5 |  | 
| 6 6 | 
             
            module GdsApi
         | 
| 7 7 | 
             
              module TestHelpers
         | 
| @@ -9,8 +9,8 @@ module GdsApi | |
| 9 9 | 
             
                module PublishingApiV2
         | 
| 10 10 | 
             
                  include ContentItemHelpers
         | 
| 11 11 |  | 
| 12 | 
            -
                  PUBLISHING_API_V2_ENDPOINT = Plek.current.find( | 
| 13 | 
            -
                  PUBLISHING_API_ENDPOINT = Plek.current.find( | 
| 12 | 
            +
                  PUBLISHING_API_V2_ENDPOINT = Plek.current.find("publishing-api") + "/v2"
         | 
| 13 | 
            +
                  PUBLISHING_API_ENDPOINT = Plek.current.find("publishing-api")
         | 
| 14 14 |  | 
| 15 15 | 
             
                  # Stub a PUT /v2/content/:content_id request with the given content id and request body.
         | 
| 16 16 | 
             
                  # if no response_hash is given, a default response as follows is created:
         | 
| @@ -30,7 +30,7 @@ module GdsApi | |
| 30 30 | 
             
                  # @param body  [String]
         | 
| 31 31 | 
             
                  # @param response_hash [Hash]
         | 
| 32 32 | 
             
                  def stub_publishing_api_put_content(content_id, body, response_hash = {})
         | 
| 33 | 
            -
                    stub_publishing_api_put(content_id, body,  | 
| 33 | 
            +
                    stub_publishing_api_put(content_id, body, "/content", response_hash)
         | 
| 34 34 | 
             
                  end
         | 
| 35 35 |  | 
| 36 36 | 
             
                  # Stub a PATCH /v2/links/:content_id request
         | 
| @@ -47,7 +47,7 @@ module GdsApi | |
| 47 47 | 
             
                  # @param content_id [UUID]
         | 
| 48 48 | 
             
                  # @param body  [String]
         | 
| 49 49 | 
             
                  def stub_publishing_api_patch_links(content_id, body)
         | 
| 50 | 
            -
                    stub_publishing_api_patch(content_id, body,  | 
| 50 | 
            +
                    stub_publishing_api_patch(content_id, body, "/links")
         | 
| 51 51 | 
             
                  end
         | 
| 52 52 |  | 
| 53 53 | 
             
                  # Stub a PATCH /v2/links/:content_id request to return a 409 response
         | 
| @@ -66,7 +66,7 @@ module GdsApi | |
| 66 66 | 
             
                  def stub_publishing_api_patch_links_conflict(content_id, body)
         | 
| 67 67 | 
             
                    previous_version = JSON.parse(body.to_json)["previous_version"]
         | 
| 68 68 | 
             
                    override_response_hash = { status: 409, body: version_conflict(previous_version) }
         | 
| 69 | 
            -
                    stub_publishing_api_patch(content_id, body,  | 
| 69 | 
            +
                    stub_publishing_api_patch(content_id, body, "/links", override_response_hash)
         | 
| 70 70 | 
             
                  end
         | 
| 71 71 |  | 
| 72 72 | 
             
                  # Stub a POST /v2/content/:content_id/publish request
         | 
| @@ -78,8 +78,8 @@ module GdsApi | |
| 78 78 | 
             
                    url = PUBLISHING_API_V2_ENDPOINT + "/content/#{content_id}/publish"
         | 
| 79 79 | 
             
                    response = {
         | 
| 80 80 | 
             
                      status: 200,
         | 
| 81 | 
            -
                      body:  | 
| 82 | 
            -
                      headers: { "Content-Type" => "application/json; charset=utf-8" }
         | 
| 81 | 
            +
                      body: "{}",
         | 
| 82 | 
            +
                      headers: { "Content-Type" => "application/json; charset=utf-8" },
         | 
| 83 83 | 
             
                    }.merge(response_hash)
         | 
| 84 84 | 
             
                    stub_request(:post, url).with(body: body).to_return(response)
         | 
| 85 85 | 
             
                  end
         | 
| @@ -93,8 +93,8 @@ module GdsApi | |
| 93 93 | 
             
                    url = PUBLISHING_API_V2_ENDPOINT + "/content/#{content_id}/republish"
         | 
| 94 94 | 
             
                    response = {
         | 
| 95 95 | 
             
                      status: 200,
         | 
| 96 | 
            -
                      body:  | 
| 97 | 
            -
                      headers: { "Content-Type" => "application/json; charset=utf-8" }
         | 
| 96 | 
            +
                      body: "{}",
         | 
| 97 | 
            +
                      headers: { "Content-Type" => "application/json; charset=utf-8" },
         | 
| 98 98 | 
             
                    }.merge(response_hash)
         | 
| 99 99 | 
             
                    stub_request(:post, url).with(body: body).to_return(response)
         | 
| 100 100 | 
             
                  end
         | 
| @@ -108,8 +108,8 @@ module GdsApi | |
| 108 108 | 
             
                    url = PUBLISHING_API_V2_ENDPOINT + "/content/#{content_id}/unpublish"
         | 
| 109 109 | 
             
                    response = {
         | 
| 110 110 | 
             
                      status: 200,
         | 
| 111 | 
            -
                      body:  | 
| 112 | 
            -
                      headers: { "Content-Type" => "application/json; charset=utf-8" }
         | 
| 111 | 
            +
                      body: "{}",
         | 
| 112 | 
            +
                      headers: { "Content-Type" => "application/json; charset=utf-8" },
         | 
| 113 113 | 
             
                    }.merge(response_hash)
         | 
| 114 114 | 
             
                    stub_request(:post, url).with(params).to_return(response)
         | 
| 115 115 | 
             
                  end
         | 
| @@ -334,7 +334,7 @@ module GdsApi | |
| 334 334 | 
             
                      results: page_items,
         | 
| 335 335 | 
             
                      total: items.count,
         | 
| 336 336 | 
             
                      pages: number_of_pages,
         | 
| 337 | 
            -
                      current_page: page
         | 
| 337 | 
            +
                      current_page: page,
         | 
| 338 338 | 
             
                    }
         | 
| 339 339 |  | 
| 340 340 | 
             
                    stub_request(:get, url)
         | 
| @@ -494,8 +494,8 @@ module GdsApi | |
| 494 494 | 
             
                  def stub_publishing_api_has_expanded_links(links, with_drafts: true, generate: false)
         | 
| 495 495 | 
             
                    links = deep_transform_keys(links, &:to_sym)
         | 
| 496 496 | 
             
                    request_params = {}
         | 
| 497 | 
            -
                    request_params[ | 
| 498 | 
            -
                    request_params[ | 
| 497 | 
            +
                    request_params["with_drafts"] = false if !with_drafts
         | 
| 498 | 
            +
                    request_params["generate"] = true if generate
         | 
| 499 499 |  | 
| 500 500 | 
             
                    url = PUBLISHING_API_V2_ENDPOINT + "/expanded-links/" + links[:content_id]
         | 
| 501 501 | 
             
                    stub_request(:get, url)
         | 
| @@ -552,7 +552,7 @@ module GdsApi | |
| 552 552 | 
             
                  #   })
         | 
| 553 553 | 
             
                  #
         | 
| 554 554 | 
             
                  def stub_publishing_api_has_lookups(lookup_hash)
         | 
| 555 | 
            -
                    url = Plek.current.find( | 
| 555 | 
            +
                    url = Plek.current.find("publishing-api") + "/lookup-by-base-path"
         | 
| 556 556 | 
             
                    stub_request(:post, url).to_return(body: lookup_hash.to_json)
         | 
| 557 557 | 
             
                  end
         | 
| 558 558 |  | 
| @@ -578,7 +578,7 @@ module GdsApi | |
| 578 578 | 
             
                    link_type = params.fetch(:link_type)
         | 
| 579 579 | 
             
                    fields = params.fetch(:fields, %w(base_path content_id document_type title))
         | 
| 580 580 |  | 
| 581 | 
            -
                    url = Plek.current.find( | 
| 581 | 
            +
                    url = Plek.current.find("publishing-api") + "/v2/linked/#{content_id}"
         | 
| 582 582 |  | 
| 583 583 | 
             
                    request_parmeters = {
         | 
| 584 584 | 
             
                      "fields" => fields,
         | 
| @@ -589,7 +589,7 @@ module GdsApi | |
| 589 589 | 
             
                      .with(query: request_parmeters)
         | 
| 590 590 | 
             
                      .and_return(
         | 
| 591 591 | 
             
                        body: items.to_json,
         | 
| 592 | 
            -
                        status: 200
         | 
| 592 | 
            +
                        status: 200,
         | 
| 593 593 | 
             
                      )
         | 
| 594 594 | 
             
                  end
         | 
| 595 595 |  | 
| @@ -655,7 +655,7 @@ module GdsApi | |
| 655 655 | 
             
                  end
         | 
| 656 656 |  | 
| 657 657 | 
             
                  def stub_publishing_api_postlike_call(method, content_id, body, resource_path, override_response_hash = {})
         | 
| 658 | 
            -
                    response_hash = { status: 200, body:  | 
| 658 | 
            +
                    response_hash = { status: 200, body: "{}", headers: { "Content-Type" => "application/json; charset=utf-8" } }
         | 
| 659 659 | 
             
                    response_hash.merge!(override_response_hash)
         | 
| 660 660 | 
             
                    response_hash[:body] = response_hash[:body].to_json if response_hash[:body].is_a?(Hash)
         | 
| 661 661 | 
             
                    url = PUBLISHING_API_V2_ENDPOINT + resource_path + "/" + content_id
         | 
| @@ -684,7 +684,7 @@ module GdsApi | |
| 684 684 | 
             
                      error: {
         | 
| 685 685 | 
             
                        code: 404,
         | 
| 686 686 | 
             
                        message: "Could not find #{type} with content_id: #{content_id}",
         | 
| 687 | 
            -
                      }
         | 
| 687 | 
            +
                      },
         | 
| 688 688 | 
             
                    }
         | 
| 689 689 | 
             
                  end
         | 
| 690 690 |  | 
| @@ -694,7 +694,7 @@ module GdsApi | |
| 694 694 | 
             
                        code: 409,
         | 
| 695 695 | 
             
                        message: "A lock-version conflict occurred. The `previous_version` you've sent (#{expected_version}) is not the same as the current lock version of the edition (#{actual_version}).",
         | 
| 696 696 | 
             
                        fields: { previous_version: ["does not match"] },
         | 
| 697 | 
            -
                      }
         | 
| 697 | 
            +
                      },
         | 
| 698 698 | 
             
                    }
         | 
| 699 699 | 
             
                  end
         | 
| 700 700 | 
             
                end
         | 
| @@ -1,19 +1,19 @@ | |
| 1 | 
            -
            require  | 
| 1 | 
            +
            require "gds_api/test_helpers/json_client_helper"
         | 
| 2 2 |  | 
| 3 3 | 
             
            module GdsApi
         | 
| 4 4 | 
             
              module TestHelpers
         | 
| 5 5 | 
             
                module Router
         | 
| 6 | 
            -
                  ROUTER_API_ENDPOINT = Plek.current.find( | 
| 6 | 
            +
                  ROUTER_API_ENDPOINT = Plek.current.find("router-api")
         | 
| 7 7 |  | 
| 8 | 
            -
                  def stub_router_has_route(path, route, bearer_token = ENV[ | 
| 8 | 
            +
                  def stub_router_has_route(path, route, bearer_token = ENV["ROUTER_API_BEARER_TOKEN"])
         | 
| 9 9 | 
             
                    stub_get_route(path, bearer_token).to_return(
         | 
| 10 10 | 
             
                      status: 200,
         | 
| 11 11 | 
             
                      body: route.to_json,
         | 
| 12 | 
            -
                      headers: { "Content-Type" => "application/json" }
         | 
| 12 | 
            +
                      headers: { "Content-Type" => "application/json" },
         | 
| 13 13 | 
             
                    )
         | 
| 14 14 | 
             
                  end
         | 
| 15 15 |  | 
| 16 | 
            -
                  def stub_router_doesnt_have_route(path, bearer_token = ENV[ | 
| 16 | 
            +
                  def stub_router_doesnt_have_route(path, bearer_token = ENV["ROUTER_API_BEARER_TOKEN"])
         | 
| 17 17 | 
             
                    stub_get_route(path, bearer_token).to_return(status: 404)
         | 
| 18 18 | 
             
                  end
         | 
| 19 19 |  | 
| @@ -47,9 +47,9 @@ module GdsApi | |
| 47 47 | 
             
                      route: {
         | 
| 48 48 | 
             
                        incoming_path: path,
         | 
| 49 49 | 
             
                        route_type: type,
         | 
| 50 | 
            -
                        handler:  | 
| 51 | 
            -
                        backend_id: backend_id
         | 
| 52 | 
            -
                      }
         | 
| 50 | 
            +
                        handler: "backend",
         | 
| 51 | 
            +
                        backend_id: backend_id,
         | 
| 52 | 
            +
                      },
         | 
| 53 53 | 
             
                    }
         | 
| 54 54 |  | 
| 55 55 | 
             
                    register_stub = stub_route_put(route)
         | 
| @@ -62,11 +62,11 @@ module GdsApi | |
| 62 62 | 
             
                      route: {
         | 
| 63 63 | 
             
                        incoming_path: path,
         | 
| 64 64 | 
             
                        route_type: type,
         | 
| 65 | 
            -
                        handler:  | 
| 65 | 
            +
                        handler: "redirect",
         | 
| 66 66 | 
             
                        redirect_to: destination,
         | 
| 67 67 | 
             
                        redirect_type: redirect_type,
         | 
| 68 68 | 
             
                        segments_mode: segments_mode,
         | 
| 69 | 
            -
                      }
         | 
| 69 | 
            +
                      },
         | 
| 70 70 | 
             
                    }
         | 
| 71 71 |  | 
| 72 72 | 
             
                    register_stub = stub_route_put(redirect)
         | 
| @@ -79,8 +79,8 @@ module GdsApi | |
| 79 79 | 
             
                      route: {
         | 
| 80 80 | 
             
                        incoming_path: path,
         | 
| 81 81 | 
             
                        route_type: type,
         | 
| 82 | 
            -
                        handler:  | 
| 83 | 
            -
                      }
         | 
| 82 | 
            +
                        handler: "gone",
         | 
| 83 | 
            +
                      },
         | 
| 84 84 | 
             
                    }
         | 
| 85 85 |  | 
| 86 86 | 
             
                    register_stub = stub_route_put(route)
         | 
| @@ -1,10 +1,10 @@ | |
| 1 | 
            -
            require  | 
| 2 | 
            -
            require  | 
| 1 | 
            +
            require "json"
         | 
| 2 | 
            +
            require "gds_api/test_helpers/json_client_helper"
         | 
| 3 3 |  | 
| 4 4 | 
             
            module GdsApi
         | 
| 5 5 | 
             
              module TestHelpers
         | 
| 6 6 | 
             
                module Search
         | 
| 7 | 
            -
                  SEARCH_ENDPOINT = Plek.current.find( | 
| 7 | 
            +
                  SEARCH_ENDPOINT = Plek.current.find("search")
         | 
| 8 8 |  | 
| 9 9 | 
             
                  def stub_any_search_post(index: nil)
         | 
| 10 10 | 
             
                    if index
         | 
| @@ -58,20 +58,20 @@ module GdsApi | |
| 58 58 |  | 
| 59 59 | 
             
                  def assert_search_deleted_item(id, index: nil, **options)
         | 
| 60 60 | 
             
                    if id =~ %r{^/}
         | 
| 61 | 
            -
                      raise ArgumentError,  | 
| 61 | 
            +
                      raise ArgumentError, "Search id must not start with a slash"
         | 
| 62 62 | 
             
                    end
         | 
| 63 63 |  | 
| 64 64 | 
             
                    if index
         | 
| 65 65 | 
             
                      assert_requested(
         | 
| 66 66 | 
             
                        :delete,
         | 
| 67 67 | 
             
                        %r{#{SEARCH_ENDPOINT}/#{index}/documents/#{id}},
         | 
| 68 | 
            -
                        **options
         | 
| 68 | 
            +
                        **options,
         | 
| 69 69 | 
             
                      )
         | 
| 70 70 | 
             
                    else
         | 
| 71 71 | 
             
                      assert_requested(
         | 
| 72 72 | 
             
                        :delete,
         | 
| 73 73 | 
             
                        %r{#{SEARCH_ENDPOINT}/documents/#{id}},
         | 
| 74 | 
            -
                        **options
         | 
| 74 | 
            +
                        **options,
         | 
| 75 75 | 
             
                      )
         | 
| 76 76 | 
             
                    end
         | 
| 77 77 | 
             
                  end
         | 
| @@ -80,7 +80,7 @@ module GdsApi | |
| 80 80 | 
             
                    assert_requested(
         | 
| 81 81 | 
             
                      :delete,
         | 
| 82 82 | 
             
                      %r{#{SEARCH_ENDPOINT}/content.*#{base_path}},
         | 
| 83 | 
            -
                      **options
         | 
| 83 | 
            +
                      **options,
         | 
| 84 84 | 
             
                    )
         | 
| 85 85 | 
             
                  end
         | 
| 86 86 |  | 
| @@ -128,8 +128,8 @@ module GdsApi | |
| 128 128 | 
             
                    File.read(
         | 
| 129 129 | 
             
                      File.expand_path(
         | 
| 130 130 | 
             
                        "../../../test/fixtures/services_and_info_fixture.json",
         | 
| 131 | 
            -
                        __dir__
         | 
| 132 | 
            -
                      )
         | 
| 131 | 
            +
                        __dir__,
         | 
| 132 | 
            +
                      ),
         | 
| 133 133 | 
             
                    )
         | 
| 134 134 | 
             
                  end
         | 
| 135 135 |  | 
| @@ -137,8 +137,8 @@ module GdsApi | |
| 137 137 | 
             
                    File.read(
         | 
| 138 138 | 
             
                      File.expand_path(
         | 
| 139 139 | 
             
                        "../../../test/fixtures/no_services_and_info_data_found_fixture.json",
         | 
| 140 | 
            -
                        __dir__
         | 
| 141 | 
            -
                      )
         | 
| 140 | 
            +
                        __dir__,
         | 
| 141 | 
            +
                      ),
         | 
| 142 142 | 
             
                    )
         | 
| 143 143 | 
             
                  end
         | 
| 144 144 |  | 
| @@ -146,8 +146,8 @@ module GdsApi | |
| 146 146 | 
             
                    File.read(
         | 
| 147 147 | 
             
                      File.expand_path(
         | 
| 148 148 | 
             
                        "../../../test/fixtures/sub_sector_organisations.json",
         | 
| 149 | 
            -
                        __dir__
         | 
| 150 | 
            -
                      )
         | 
| 149 | 
            +
                        __dir__,
         | 
| 150 | 
            +
                      ),
         | 
| 151 151 | 
             
                    )
         | 
| 152 152 | 
             
                  end
         | 
| 153 153 |  | 
| @@ -155,8 +155,8 @@ module GdsApi | |
| 155 155 | 
             
                    File.read(
         | 
| 156 156 | 
             
                      File.expand_path(
         | 
| 157 157 | 
             
                        "../../../test/fixtures/new_policies_for_dwp.json",
         | 
| 158 | 
            -
                        __dir__
         | 
| 159 | 
            -
                      )
         | 
| 158 | 
            +
                        __dir__,
         | 
| 159 | 
            +
                      ),
         | 
| 160 160 | 
             
                    )
         | 
| 161 161 | 
             
                  end
         | 
| 162 162 |  | 
| @@ -164,8 +164,8 @@ module GdsApi | |
| 164 164 | 
             
                    File.read(
         | 
| 165 165 | 
             
                      File.expand_path(
         | 
| 166 166 | 
             
                        "../../../test/fixtures/old_policies_for_dwp.json",
         | 
| 167 | 
            -
                        __dir__
         | 
| 168 | 
            -
                      )
         | 
| 167 | 
            +
                        __dir__,
         | 
| 168 | 
            +
                      ),
         | 
| 169 169 | 
             
                    )
         | 
| 170 170 | 
             
                  end
         | 
| 171 171 |  | 
| @@ -184,7 +184,7 @@ module GdsApi | |
| 184 184 | 
             
                  def example_query
         | 
| 185 185 | 
             
                    {
         | 
| 186 186 | 
             
                      filter_organisations: %w[an-organisation-slug],
         | 
| 187 | 
            -
                      facet_specialist_sectors: "1000,examples:4,example_scope:global,order:value.title"
         | 
| 187 | 
            +
                      facet_specialist_sectors: "1000,examples:4,example_scope:global,order:value.title",
         | 
| 188 188 | 
             
                    }
         | 
| 189 189 | 
             
                  end
         | 
| 190 190 | 
             
                end
         | 
| @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            module GdsApi
         | 
| 2 2 | 
             
              module TestHelpers
         | 
| 3 3 | 
             
                module Support
         | 
| 4 | 
            -
                  SUPPORT_ENDPOINT = Plek.current.find( | 
| 4 | 
            +
                  SUPPORT_ENDPOINT = Plek.current.find("support")
         | 
| 5 5 |  | 
| 6 6 | 
             
                  def stub_support_foi_request_creation(request_details = nil)
         | 
| 7 7 | 
             
                    post_stub = stub_http_request(:post, "#{SUPPORT_ENDPOINT}/foi_requests")
         | 
| @@ -1,10 +1,10 @@ | |
| 1 | 
            -
            require  | 
| 2 | 
            -
            require  | 
| 1 | 
            +
            require "cgi"
         | 
| 2 | 
            +
            require "plek"
         | 
| 3 3 |  | 
| 4 4 | 
             
            module GdsApi
         | 
| 5 5 | 
             
              module TestHelpers
         | 
| 6 6 | 
             
                module SupportApi
         | 
| 7 | 
            -
                  SUPPORT_API_ENDPOINT = Plek.current.find( | 
| 7 | 
            +
                  SUPPORT_API_ENDPOINT = Plek.current.find("support-api")
         | 
| 8 8 |  | 
| 9 9 | 
             
                  def stub_support_api_problem_report_creation(request_details = nil)
         | 
| 10 10 | 
             
                    post_stub = stub_http_request(:post, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/problem-reports")
         | 
| @@ -98,15 +98,15 @@ module GdsApi | |
| 98 98 | 
             
                        web_url: "https://www.gov.uk/government/organisations/cabinet-office",
         | 
| 99 99 | 
             
                        title: "Cabinet Office",
         | 
| 100 100 | 
             
                        acronym: "CO",
         | 
| 101 | 
            -
                        govuk_status: "live"
         | 
| 101 | 
            +
                        govuk_status: "live",
         | 
| 102 102 | 
             
                      },
         | 
| 103 103 | 
             
                      {
         | 
| 104 104 | 
             
                        slug: "gds",
         | 
| 105 105 | 
             
                        web_url: "https://www.gov.uk/government/organisations/gds",
         | 
| 106 106 | 
             
                        title: "Government Digital Service",
         | 
| 107 107 | 
             
                        acronym: "GDS",
         | 
| 108 | 
            -
                        govuk_status: "live"
         | 
| 109 | 
            -
                      }
         | 
| 108 | 
            +
                        govuk_status: "live",
         | 
| 109 | 
            +
                      },
         | 
| 110 110 | 
             
                    ]
         | 
| 111 111 |  | 
| 112 112 | 
             
                    stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/organisations").
         | 
| @@ -119,7 +119,7 @@ module GdsApi | |
| 119 119 | 
             
                      web_url: "https://www.gov.uk/government/organisations/#{slug}",
         | 
| 120 120 | 
             
                      title: "Cabinet Office",
         | 
| 121 121 | 
             
                      acronym: "CO",
         | 
| 122 | 
            -
                      govuk_status: "live"
         | 
| 122 | 
            +
                      govuk_status: "live",
         | 
| 123 123 | 
             
                    }
         | 
| 124 124 |  | 
| 125 125 | 
             
                    stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/organisations/#{slug}").
         | 
| @@ -143,7 +143,7 @@ module GdsApi | |
| 143 143 | 
             
                  def stub_support_api_feedback_export_request(id, response_body = nil)
         | 
| 144 144 | 
             
                    response_body ||= {
         | 
| 145 145 | 
             
                      filename: "feedex_0000-00-00_2015-01-01.csv",
         | 
| 146 | 
            -
                      ready: true
         | 
| 146 | 
            +
                      ready: true,
         | 
| 147 147 | 
             
                    }
         | 
| 148 148 |  | 
| 149 149 | 
             
                    stub_http_request(:get, "#{SUPPORT_API_ENDPOINT}/anonymous-feedback/export-requests/#{id}").
         | 
| @@ -1,12 +1,12 @@ | |
| 1 | 
            -
            require  | 
| 2 | 
            -
            require  | 
| 1 | 
            +
            require "gds_api/test_helpers/json_client_helper"
         | 
| 2 | 
            +
            require "gds_api/test_helpers/common_responses"
         | 
| 3 3 |  | 
| 4 4 | 
             
            module GdsApi
         | 
| 5 5 | 
             
              module TestHelpers
         | 
| 6 6 | 
             
                module Worldwide
         | 
| 7 7 | 
             
                  include GdsApi::TestHelpers::CommonResponses
         | 
| 8 8 |  | 
| 9 | 
            -
                  WORLDWIDE_API_ENDPOINT = Plek.current.find( | 
| 9 | 
            +
                  WORLDWIDE_API_ENDPOINT = Plek.current.find("whitehall-admin")
         | 
| 10 10 |  | 
| 11 11 | 
             
                  # Sets up the index endpoints for the given country slugs
         | 
| 12 12 | 
             
                  # The stubs are setup to paginate in chunks of 20
         | 
| @@ -43,7 +43,7 @@ module GdsApi | |
| 43 43 |  | 
| 44 44 | 
             
                      if i.zero?
         | 
| 45 45 | 
             
                        # First page exists at URL with and without page param
         | 
| 46 | 
            -
                        stub_request(:get, links[:self].sub(/\?page=1/,  | 
| 46 | 
            +
                        stub_request(:get, links[:self].sub(/\?page=1/, "")).
         | 
| 47 47 | 
             
                          to_return(status: 200, body: page_details.to_json, headers: { "Link" => link_headers.join(", ") })
         | 
| 48 48 | 
             
                      end
         | 
| 49 49 | 
             
                    end
         | 
| @@ -105,9 +105,9 @@ module GdsApi | |
| 105 105 | 
             
                      },
         | 
| 106 106 | 
             
                      "organisations" => {
         | 
| 107 107 | 
             
                        "id" => "https://www.gov.uk/api/world-locations/#{slug}/organisations",
         | 
| 108 | 
            -
                        "web_url" => "https://www.gov.uk/government/world/#{slug}#organisations"
         | 
| 108 | 
            +
                        "web_url" => "https://www.gov.uk/government/world/#{slug}#organisations",
         | 
| 109 109 | 
             
                      },
         | 
| 110 | 
            -
                      "content_id" => "content_id_for_#{slug}"
         | 
| 110 | 
            +
                      "content_id" => "content_id_for_#{slug}",
         | 
| 111 111 | 
             
                    }
         | 
| 112 112 | 
             
                  end
         | 
| 113 113 |  |