From: Anton Khorev Date: Tue, 2 Apr 2024 11:36:29 +0000 (+0300) Subject: Simplify element multi fetch paths in api tests X-Git-Tag: live~220^2~4 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/352e5de4b99f91be23bb0ef5a248a7a90310ea32 Simplify element multi fetch paths in api tests --- diff --git a/test/controllers/api/nodes_controller_test.rb b/test/controllers/api/nodes_controller_test.rb index 7becffddc..e1da1e946 100644 --- a/test/controllers/api/nodes_controller_test.rb +++ b/test/controllers/api/nodes_controller_test.rb @@ -456,11 +456,11 @@ module Api assert_response :bad_request # check error when no parameter value provided - get nodes_path, :params => { :nodes => "" } + get nodes_path(:nodes => "") assert_response :bad_request # test a working call - get nodes_path, :params => { :nodes => "#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id}" } + get nodes_path(:nodes => "#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id}") assert_response :success assert_select "osm" do assert_select "node", :count => 5 @@ -472,7 +472,7 @@ module Api end # test a working call with json format - get nodes_path, :params => { :nodes => "#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id}", :format => "json" } + get nodes_path(:nodes => "#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id}", :format => "json") js = ActiveSupport::JSON.decode(@response.body) assert_not_nil js @@ -485,7 +485,7 @@ module Api assert_equal 1, (js["elements"].count { |a| a["id"] == node5.id && a["visible"] == false }) # check error when a non-existent node is included - get nodes_path, :params => { :nodes => "#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id},0" } + get nodes_path(:nodes => "#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id},0") assert_response :not_found end diff --git a/test/controllers/api/relations_controller_test.rb b/test/controllers/api/relations_controller_test.rb index 7ff369fa4..4a6d55efb 100644 --- a/test/controllers/api/relations_controller_test.rb +++ b/test/controllers/api/relations_controller_test.rb @@ -178,11 +178,11 @@ module Api assert_response :bad_request # check error when no parameter value provided - get relations_path, :params => { :relations => "" } + get relations_path(:relations => "") assert_response :bad_request # test a working call - get relations_path, :params => { :relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id}" } + get relations_path(:relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id}") assert_response :success assert_select "osm" do assert_select "relation", :count => 4 @@ -193,7 +193,7 @@ module Api end # test a working call with json format - get relations_path, :params => { :relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id}", :format => "json" } + get relations_path(:relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id}", :format => "json") js = ActiveSupport::JSON.decode(@response.body) assert_not_nil js @@ -205,7 +205,7 @@ module Api assert_equal 1, (js["elements"].count { |a| a["id"] == relation4.id && a["visible"].nil? }) # check error when a non-existent relation is included - get relations_path, :params => { :relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id},0" } + get relations_path(:relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id},0") assert_response :not_found end diff --git a/test/controllers/api/ways_controller_test.rb b/test/controllers/api/ways_controller_test.rb index 791da8029..c5c3c0e8a 100644 --- a/test/controllers/api/ways_controller_test.rb +++ b/test/controllers/api/ways_controller_test.rb @@ -102,11 +102,11 @@ module Api assert_response :bad_request # check error when no parameter value provided - get ways_path, :params => { :ways => "" } + get ways_path(:ways => "") assert_response :bad_request # test a working call - get ways_path, :params => { :ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id}" } + get ways_path(:ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id}") assert_response :success assert_select "osm" do assert_select "way", :count => 4 @@ -117,7 +117,7 @@ module Api end # test a working call with json format - get ways_path, :params => { :ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id}", :format => "json" } + get ways_path(:ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id}", :format => "json") js = ActiveSupport::JSON.decode(@response.body) assert_not_nil js @@ -129,7 +129,7 @@ module Api assert_equal 1, (js["elements"].count { |a| a["id"] == way4.id && a["visible"].nil? }) # check error when a non-existent way is included - get ways_path, :params => { :ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id},0" } + get ways_path(:ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id},0") assert_response :not_found end