Make api element index paths resourceful
This commit is contained in:
parent
0a4442781c
commit
35d5276587
4 changed files with 19 additions and 18 deletions
|
@ -174,15 +174,15 @@ module Api
|
|||
relation4.old_relations.find_by(:version => 1).redact!(create(:redaction))
|
||||
|
||||
# check error when no parameter provided
|
||||
get relations_path
|
||||
get api_relations_path
|
||||
assert_response :bad_request
|
||||
|
||||
# check error when no parameter value provided
|
||||
get relations_path(:relations => "")
|
||||
get api_relations_path(:relations => "")
|
||||
assert_response :bad_request
|
||||
|
||||
# test a working call
|
||||
get relations_path(:relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id}")
|
||||
get api_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(:relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id}", :format => "json")
|
||||
get api_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(:relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id},0")
|
||||
get api_relations_path(:relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id},0")
|
||||
assert_response :not_found
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue