Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump gds-api-adapters from 95.1.0 to 96.0.0 #4056

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ GEM
parslet
ffi (1.16.3)
find_a_port (1.0.1)
gds-api-adapters (95.1.0)
gds-api-adapters (96.0.0)
addressable
link_header
null_logger
Expand Down Expand Up @@ -236,7 +236,7 @@ GEM
method_source (1.0.0)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0305)
mime-types-data (3.2024.0507)
mini_mime (1.1.5)
mini_portile2 (2.8.6)
minitest (5.22.3)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/place_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def places_from_imminence
imminence_response = Frontend.imminence_api.places_for_postcode(
content_item_hash["details"]["place_type"],
postcode,
Frontend::IMMINENCE_QUERY_LIMIT,
Frontend::PLACES_MANAGER_QUERY_LIMIT,
local_authority_slug,
)
imminence_response_from_data(postcode, imminence_response, nil)
Expand Down
6 changes: 3 additions & 3 deletions config/initializers/imminence.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "gds_api/imminence"
require "gds_api/places_manager"

Frontend.imminence_api = GdsApi::Imminence.new(Plek.new.find("imminence"))
Frontend.imminence_api = GdsApi::PlacesManager.new(Plek.new.find("places-manager"))

Frontend::IMMINENCE_QUERY_LIMIT = 10
Frontend::PLACES_MANAGER_QUERY_LIMIT = 10
2 changes: 1 addition & 1 deletion startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [[ $1 == "--live" ]] ; then
PLEK_SERVICE_LICENSIFY_URI=${PLEK_SERVICE_LICENSIFY_URI-https://licensify.publishing.service.gov.uk} \
PLEK_SERVICE_CONTENT_STORE_URI=${PLEK_SERVICE_CONTENT_STORE_URI-https://www.gov.uk/api} \
PLEK_SERVICE_STATIC_URI=${PLEK_SERVICE_STATIC_URI-https://assets.publishing.service.gov.uk} \
PLEK_SERVICE_IMMINENCE_URI=${PLEK_SERVICE_IMMINENCE_URI-https://imminence.publishing.service.gov.uk} \
PLEK_SERVICE_PLACES_MANAGER_URI=${PLEK_SERVICE_PLACES_MANAGER_URI-https://places-manager.publishing.service.gov.uk} \
./bin/dev
else
echo "ERROR: other startup modes are not supported"
Expand Down
10 changes: 5 additions & 5 deletions test/functional/place_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
require "test_helper"
require "gds_api/test_helpers/imminence"
require "gds_api/test_helpers/places_manager"

class PlaceControllerTest < ActionController::TestCase
include GdsApi::TestHelpers::Imminence
include GdsApi::TestHelpers::PlacesManager

valid_postcode = "SW1A 2AA"
invalid_postcode = "1234 2AA"

setup do
content_store_has_random_item(base_path: "/slug", schema: "place", details: { "place_type" => "slug" })
stub_imminence_has_places_for_postcode([{
stub_places_manager_has_places_for_postcode([{
"access_notes" => "The London Passport Office is fully accessible to wheelchair users. ",
"address1" => nil,
"address2" => "89 Eccleston Square",
Expand All @@ -27,9 +27,9 @@ class PlaceControllerTest < ActionController::TestCase
"town" => "London",
"url" => "http://www.example.com/london_ips_office",
}], "slug", valid_postcode, 10, nil)
query_hash = { "postcode" => invalid_postcode, "limit" => Frontend::IMMINENCE_QUERY_LIMIT }
query_hash = { "postcode" => invalid_postcode, "limit" => Frontend::PLACES_MANAGER_QUERY_LIMIT }
return_data = { "error" => ImminenceResponse::INVALID_POSTCODE }
stub_imminence_places_request("slug", query_hash, return_data, 400)
stub_places_manager_places_request("slug", query_hash, return_data, 400)
end

context "GET show" do
Expand Down
24 changes: 12 additions & 12 deletions test/integration/place_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require "integration_test_helper"
require "gds_api/test_helpers/imminence"
require "gds_api/test_helpers/places_manager"

class PlacesTest < ActionDispatch::IntegrationTest
include GdsApi::TestHelpers::Imminence
include GdsApi::TestHelpers::PlacesManager

setup do
@payload = {
Expand Down Expand Up @@ -119,7 +119,7 @@ class PlacesTest < ActionDispatch::IntegrationTest

context "given a valid postcode" do
setup do
stub_imminence_has_places_for_postcode(@places, "find-passport-offices", "SW1A 1AA", Frontend::IMMINENCE_QUERY_LIMIT, nil)
stub_places_manager_has_places_for_postcode(@places, "find-passport-offices", "SW1A 1AA", Frontend::PLACES_MANAGER_QUERY_LIMIT, nil)

visit "/passport-interview-office"
fill_in "Enter a postcode", with: "SW1A 1AA"
Expand Down Expand Up @@ -206,7 +206,7 @@ class PlacesTest < ActionDispatch::IntegrationTest
setup do
@places = []

stub_imminence_has_places_for_postcode(@places, "find-passport-offices", "SW1A 1AA", Frontend::IMMINENCE_QUERY_LIMIT, nil)
stub_places_manager_has_places_for_postcode(@places, "find-passport-offices", "SW1A 1AA", Frontend::PLACES_MANAGER_QUERY_LIMIT, nil)

visit "/passport-interview-office"
fill_in "Enter a postcode", with: "SW1A 1AA"
Expand Down Expand Up @@ -264,9 +264,9 @@ class PlacesTest < ActionDispatch::IntegrationTest

context "given an invalid postcode" do
setup do
query_hash = { "postcode" => "BAD POSTCODE", "limit" => Frontend::IMMINENCE_QUERY_LIMIT }
query_hash = { "postcode" => "BAD POSTCODE", "limit" => Frontend::PLACES_MANAGER_QUERY_LIMIT }
return_data = { "error" => "invalidPostcodeError" }
stub_imminence_places_request("find-passport-offices", query_hash, return_data, 400)
stub_places_manager_places_request("find-passport-offices", query_hash, return_data, 400)

visit "/passport-interview-office"
fill_in "Enter a postcode", with: "BAD POSTCODE"
Expand All @@ -292,10 +292,10 @@ class PlacesTest < ActionDispatch::IntegrationTest

context "given a valid postcode with no locations returned" do
setup do
query_hash = { "postcode" => "JE4 5TP", "limit" => Frontend::IMMINENCE_QUERY_LIMIT }
query_hash = { "postcode" => "JE4 5TP", "limit" => Frontend::PLACES_MANAGER_QUERY_LIMIT }
return_data = { "error" => "validPostcodeNoLocation" }

stub_imminence_places_request("find-passport-offices", query_hash, return_data, 400)
stub_places_manager_places_request("find-passport-offices", query_hash, return_data, 400)

visit "/passport-interview-office"
fill_in "Enter a postcode", with: "JE4 5TP"
Expand All @@ -322,7 +322,7 @@ class PlacesTest < ActionDispatch::IntegrationTest
{ "address" => "House 3", "local_authority_slug" => "ceechester" },
]

stub_imminence_has_multiple_authorities_for_postcode(addresses, "find-passport-offices", "CH25 9BJ", Frontend::IMMINENCE_QUERY_LIMIT)
stub_places_manager_has_multiple_authorities_for_postcode(addresses, "find-passport-offices", "CH25 9BJ", Frontend::PLACES_MANAGER_QUERY_LIMIT)

visit "/passport-interview-office"
fill_in "Enter a postcode", with: "CH25 9BJ"
Expand All @@ -334,10 +334,10 @@ class PlacesTest < ActionDispatch::IntegrationTest
end
end

context "given an internal error response from imminence" do
context "given an internal error response from places manager" do
setup do
query_hash = { "postcode" => "JE4 5TP", "limit" => Frontend::IMMINENCE_QUERY_LIMIT }
stub_imminence_places_request("find-passport-offices", query_hash, {}, 500)
query_hash = { "postcode" => "JE4 5TP", "limit" => Frontend::PLACES_MANAGER_QUERY_LIMIT }
stub_places_manager_places_request("find-passport-offices", query_hash, {}, 500)

visit "/passport-interview-office"
fill_in "Enter a postcode", with: "JE4 5TP"
Expand Down