From 63f0b9257d62818d435ef6510340b9681efe547b Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 10 Jul 2024 19:17:09 +0100 Subject: [PATCH] Don't try and change the HTTP client user agent Because we only create the client once we can't override the server URL for a test to change the user agent as we don't know which test will create it. --- test/lib/nominatim_test.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/lib/nominatim_test.rb b/test/lib/nominatim_test.rb index e7cb6fb59..1ac775a88 100644 --- a/test/lib/nominatim_test.rb +++ b/test/lib/nominatim_test.rb @@ -5,27 +5,25 @@ class NominatimTest < ActiveSupport::TestCase stub_request(:get, %r{^https://nominatim\.example\.com/reverse\?}) .to_return(:body => "Target location") - with_settings(:nominatim_url => "https://nominatim.example.com/", - :server_url => "osm-website.example.com") do + with_settings(:nominatim_url => "https://nominatim.example.com/") do location = Nominatim.describe_location(60, 30, 10, "en") assert_equal "Target location", location end assert_requested :get, "https://nominatim.example.com/reverse?lat=60&lon=30&zoom=10&accept-language=en", - :headers => { "User-Agent" => "osm-website.example.com" } + :headers => { "User-Agent" => Settings.server_url } end def test_describe_location_no_result stub_request(:get, %r{^https://nominatim\.example\.com/reverse\?}) .to_return(:body => "Unable to geocode") - with_settings(:nominatim_url => "https://nominatim.example.com/", - :server_url => "osm-website.example.com") do + with_settings(:nominatim_url => "https://nominatim.example.com/") do location = Nominatim.describe_location(1, 2, 14, "en") assert_equal "1.000, 2.000", location end assert_requested :get, "https://nominatim.example.com/reverse?lat=1&lon=2&zoom=14&accept-language=en", - :headers => { "User-Agent" => "osm-website.example.com" } + :headers => { "User-Agent" => Settings.server_url } end end -- 2.39.5