Simplify element multi fetch paths in api tests
This commit is contained in:
parent
c79da4746a
commit
352e5de4b9
3 changed files with 12 additions and 12 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue