)
assert_routing(
{ :path => "/api/0.6/relation/1/full", :method => :get },
- { :controller => "api/relations", :action => "full", :id => "1" }
+ { :controller => "api/relations", :action => "full", :id => "1", :format => "xml" }
)
assert_routing(
{ :path => "/api/0.6/relation/1", :method => :get },
- { :controller => "api/relations", :action => "show", :id => "1" }
+ { :controller => "api/relations", :action => "show", :id => "1", :format => "xml" }
)
assert_routing(
{ :path => "/api/0.6/relation/1", :method => :put },
)
assert_routing(
{ :path => "/api/0.6/relations", :method => :get },
- { :controller => "api/relations", :action => "index" }
+ { :controller => "api/relations", :action => "index", :format => "xml" }
)
assert_routing(
{ :path => "/api/0.6/node/1/relations", :method => :get },
- { :controller => "api/relations", :action => "relations_for_node", :id => "1" }
+ { :controller => "api/relations", :action => "relations_for_node", :id => "1", :format => "xml" }
)
assert_routing(
{ :path => "/api/0.6/way/1/relations", :method => :get },
- { :controller => "api/relations", :action => "relations_for_way", :id => "1" }
+ { :controller => "api/relations", :action => "relations_for_way", :id => "1", :format => "xml" }
)
assert_routing(
{ :path => "/api/0.6/relation/1/relations", :method => :get },
- { :controller => "api/relations", :action => "relations_for_relation", :id => "1" }
+ { :controller => "api/relations", :action => "relations_for_relation", :id => "1", :format => "xml" }
)
end
def test_show
# check that a visible relation is returned properly
- get :show, :params => { :id => create(:relation).id }
+ get :show, :params => { :id => create(:relation).id }, :format => :xml
assert_response :success
# check that an invisible relation is not returned
- get :show, :params => { :id => create(:relation, :deleted).id }
+ get :show, :params => { :id => create(:relation, :deleted).id }, :format => :xml
assert_response :gone
# check chat a non-existent relation is not returned
- get :show, :params => { :id => 0 }
+ get :show, :params => { :id => 0 }, :format => :xml
assert_response :not_found
end
def check_relations_for_element(method, type, id, expected_relations)
# check the "relations for relation" mode
- get method, :params => { :id => id }
+ get method, :params => { :id => id }, :format => :xml
assert_response :success
# count one osm element
def test_full
# check the "full" mode
- get :full, :params => { :id => 999999 }
+ get :full, :params => { :id => 999999 }, :format => :xml
assert_response :not_found
- get :full, :params => { :id => create(:relation, :deleted).id }
+ get :full, :params => { :id => create(:relation, :deleted).id }, :format => :xml
assert_response :gone
- get :full, :params => { :id => create(:relation).id }
+ get :full, :params => { :id => create(:relation).id }, :format => :xml
assert_response :success
# FIXME: check whether this contains the stuff we want!
end
relation4.old_relations.find_by(:version => 1).redact!(create(:redaction))
# check error when no parameter provided
- get :index
+ get :index, :format => :xml
assert_response :bad_request
# check error when no parameter value provided
- get :index, :params => { :relations => "" }
+ get :index, :params => { :relations => "" }, :format => :xml
assert_response :bad_request
# test a working call
- get :index, :params => { :relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id}" }
+ get :index, :params => { :relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id}" }, :format => :xml
assert_response :success
assert_select "osm" do
assert_select "relation", :count => 4
end
# check error when a non-existent relation is included
- get :index, :params => { :relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id},0" }
+ get :index, :params => { :relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id},0" }, :format => :xml
assert_response :not_found
end
assert_equal true, checkrelation.visible,
"saved relation is not visible"
# ok the relation is there but can we also retrieve it?
- get :show, :params => { :id => relationid }
+ get :show, :params => { :id => relationid }, :format => :xml
assert_response :success
###
"saved relation is not visible"
# ok the relation is there but can we also retrieve it?
- get :show, :params => { :id => relationid }
+ get :show, :params => { :id => relationid }, :format => :xml
assert_response :success
###
"saved relation is not visible"
# ok the relation is there but can we also retrieve it?
- get :show, :params => { :id => relationid }
+ get :show, :params => { :id => relationid }, :format => :xml
assert_response :success
###
assert_equal true, checkrelation.visible,
"saved relation is not visible"
# ok the relation is there but can we also retrieve it?
- get :show, :params => { :id => relationid }
+ get :show, :params => { :id => relationid }, :format => :xml
assert_response :success
end
assert_response :success, "can't update relation for add #{element.class}/bbox test: #{@response.body}"
# get it back and check the ordering
- get :show, :params => { :id => relation.id }
+ get :show, :params => { :id => relation.id }, :format => :xml
assert_response :success, "can't read back the relation: #{@response.body}"
check_ordering(relation_xml, @response.body)
end
relation_id = @response.body.to_i
# get it back and check the ordering
- get :show, :params => { :id => relation_id }
+ get :show, :params => { :id => relation_id }, :format => :xml
assert_response :success, "can't read back the relation: #{@response.body}"
check_ordering(doc, @response.body)
assert_equal 2, @response.body.to_i
# get it back again and check the ordering again
- get :show, :params => { :id => relation_id }
+ get :show, :params => { :id => relation_id }, :format => :xml
assert_response :success, "can't read back the relation: #{@response.body}"
check_ordering(doc, @response.body)
# check the ordering in the history tables:
with_controller(OldRelationsController.new) do
- get :version, :params => { :id => relation_id, :version => 2 }
+ get :version, :params => { :id => relation_id, :version => 2 }, :format => :xml
assert_response :success, "can't read back version 2 of the relation #{relation_id}"
check_ordering(doc, @response.body)
end
relation_id = @response.body.to_i
# get it back and check the ordering
- get :show, :params => { :id => relation_id }
+ get :show, :params => { :id => relation_id }, :format => :xml
assert_response :success, "can't read back the relation: #{relation_id}"
check_ordering(doc, @response.body)
end
relation_id = @response.body.to_i
# check the ordering in the current tables:
- get :show, :params => { :id => relation_id }
+ get :show, :params => { :id => relation_id }, :format => :xml
assert_response :success, "can't read back the relation: #{@response.body}"
check_ordering(doc, @response.body)
# check the ordering in the history tables:
with_controller(OldRelationsController.new) do
- get :version, :params => { :id => relation_id, :version => 1 }
+ get :version, :params => { :id => relation_id, :version => 1 }, :format => :xml
assert_response :success, "can't read back version 1 of the relation: #{@response.body}"
check_ordering(doc, @response.body)
end
# now download the changeset to check its bounding box
with_controller(Api::ChangesetsController.new) do
- get :show, :params => { :id => changeset_id }
+ get :show, :params => { :id => changeset_id }, :format => :xml
assert_response :success, "can't re-read changeset for modify test"
assert_select "osm>changeset", 1, "Changeset element doesn't exist in #{@response.body}"
assert_select "osm>changeset[id='#{changeset_id}']", 1, "Changeset id=#{changeset_id} doesn't exist in #{@response.body}"
# doc is returned.
def with_relation(id, ver = nil)
if ver.nil?
- get :show, :params => { :id => id }
+ get :show, :params => { :id => id }, :format => :xml
else
with_controller(OldRelationsController.new) do
- get :version, :params => { :id => id, :version => ver }
+ get :version, :params => { :id => id, :version => ver }, :format => :xml
end
end
assert_response :success
version = @response.body.to_i
# now get the new version
- get :show, :params => { :id => rel_id }
+ get :show, :params => { :id => rel_id }, :format => :xml
assert_response :success
new_rel = xml_parse(@response.body)
end
# now get the new version
- get :show, :params => { :id => rel_id }
+ get :show, :params => { :id => rel_id }, :format => :xml
assert_response :success
new_rel = xml_parse(@response.body)