get "node/:id/relations" => "api/relations#relations_for_node", :as => :node_relations, :id => /\d+/
get "node/:id/history" => "api/old_nodes#history", :as => :api_node_history, :id => /\d+/
post "node/:id/:version/redact" => "api/old_nodes#redact", :as => :node_version_redact, :version => /\d+/, :id => /\d+/
- get "node/:id/:version" => "api/old_nodes#show", :as => :node_version, :id => /\d+/, :version => /\d+/
+ get "node/:id/:version" => "api/old_nodes#show", :as => :api_old_node, :id => /\d+/, :version => /\d+/
get "node/:id" => "api/nodes#show", :as => :api_node, :id => /\d+/
put "node/:id" => "api/nodes#update", :id => /\d+/
delete "node/:id" => "api/nodes#delete", :id => /\d+/
get "way/:id/full" => "api/ways#full", :as => :way_full, :id => /\d+/
get "way/:id/relations" => "api/relations#relations_for_way", :as => :way_relations, :id => /\d+/
post "way/:id/:version/redact" => "api/old_ways#redact", :as => :way_version_redact, :version => /\d+/, :id => /\d+/
- get "way/:id/:version" => "api/old_ways#show", :as => :way_version, :id => /\d+/, :version => /\d+/
+ get "way/:id/:version" => "api/old_ways#show", :as => :api_old_way, :id => /\d+/, :version => /\d+/
get "way/:id" => "api/ways#show", :as => :api_way, :id => /\d+/
put "way/:id" => "api/ways#update", :id => /\d+/
delete "way/:id" => "api/ways#delete", :id => /\d+/
get "relation/:id/history" => "api/old_relations#history", :as => :api_relation_history, :id => /\d+/
get "relation/:id/full" => "api/relations#full", :as => :relation_full, :id => /\d+/
post "relation/:id/:version/redact" => "api/old_relations#redact", :as => :relation_version_redact, :version => /\d+/, :id => /\d+/
- get "relation/:id/:version" => "api/old_relations#show", :as => :relation_version, :id => /\d+/, :version => /\d+/
+ get "relation/:id/:version" => "api/old_relations#show", :as => :api_old_relation, :id => /\d+/, :version => /\d+/
get "relation/:id" => "api/relations#show", :as => :api_relation, :id => /\d+/
put "relation/:id" => "api/relations#update", :id => /\d+/
delete "relation/:id" => "api/relations#delete", :id => /\d+/
# check all the versions
versions.each_key do |key|
- get node_version_path(:id => nodeid, :version => key.to_i)
+ get api_old_node_path(:id => nodeid, :version => key.to_i)
assert_response :success,
"couldn't get version #{key.to_i} of node #{nodeid}"
node_v1 = node.old_nodes.find_by(:version => 1)
node_v1.redact!(create(:redaction))
- get node_version_path(:id => node_v1.node_id, :version => node_v1.version)
+ get api_old_node_path(:id => node_v1.node_id, :version => node_v1.version)
assert_response :forbidden, "Redacted node shouldn't be visible via the version API."
# not even to a logged-in user
auth_header = basic_authorization_header create(:user).email, "test"
- get node_version_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header
+ get api_old_node_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header
assert_response :forbidden, "Redacted node shouldn't be visible via the version API, even when logged in."
end
# check moderator can still see the redacted data, when passing
# the appropriate flag
- get node_version_path(:id => node_v3.node_id, :version => node_v3.version), :headers => auth_header
+ get api_old_node_path(:id => node_v3.node_id, :version => node_v3.version), :headers => auth_header
assert_response :forbidden, "After redaction, node should be gone for moderator, when flag not passed."
- get node_version_path(:id => node_v3.node_id, :version => node_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header
+ get api_old_node_path(:id => node_v3.node_id, :version => node_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header
assert_response :success, "After redaction, node should not be gone for moderator, when flag passed."
# and when accessed via history
auth_header = basic_authorization_header create(:user).email, "test"
# check can't see the redacted data
- get node_version_path(:id => node_v3.node_id, :version => node_v3.version), :headers => auth_header
+ get api_old_node_path(:id => node_v3.node_id, :version => node_v3.version), :headers => auth_header
assert_response :forbidden, "Redacted node shouldn't be visible via the version API."
# and when accessed via history
# check moderator can now see the redacted data, when not
# passing the aspecial flag
- get node_version_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header
+ get api_old_node_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header
assert_response :success, "After unredaction, node should not be gone for moderator."
# and when accessed via history
auth_header = basic_authorization_header create(:user).email, "test"
# check normal user can now see the redacted data
- get node_version_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header
+ get api_old_node_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header
assert_response :success, "After unredaction, node should be visible to normal users."
# and when accessed via history
end
def do_redact_node(node, redaction, headers = {})
- get node_version_path(:id => node.node_id, :version => node.version), :headers => headers
+ get api_old_node_path(:id => node.node_id, :version => node.version), :headers => headers
assert_response :success, "should be able to get version #{node.version} of node #{node.node_id}."
# now redact it
assert_not_nil current_node, "getting node #{node_id} returned nil"
# get the "old" version of the node from the old_node interface
- get node_version_path(:id => node_id, :version => current_node.version)
+ get api_old_node_path(:id => node_id, :version => current_node.version)
assert_response :success, "cant get old node #{node_id}, v#{current_node.version}"
old_node = Node.from_xml(@response.body)
end
def check_not_found_id_version(id, version)
- get node_version_path(:id => id, :version => version)
+ get api_old_node_path(:id => id, :version => version)
assert_response :not_found
rescue ActionController::UrlGenerationError => e
assert_match(/No route matches/, e.to_s)
relation_v1 = relation.old_relations.find_by(:version => 1)
relation_v1.redact!(create(:redaction))
- get relation_version_path(:id => relation_v1.relation_id, :version => relation_v1.version)
+ get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version)
assert_response :forbidden, "Redacted relation shouldn't be visible via the version API."
# not even to a logged-in user
auth_header = basic_authorization_header create(:user).email, "test"
- get relation_version_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
+ get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
assert_response :forbidden, "Redacted relation shouldn't be visible via the version API, even when logged in."
end
# not even to a logged-in user
auth_header = basic_authorization_header create(:user).email, "test"
- get relation_version_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
+ get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
get api_relation_history_path(:id => relation_v1.relation_id), :headers => auth_header
assert_response :success, "Redaction shouldn't have stopped history working."
assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 0,
# check moderator can still see the redacted data, when passing
# the appropriate flag
- get relation_version_path(:id => relation_v3.relation_id, :version => relation_v3.version), :headers => auth_header
+ get api_old_relation_path(:id => relation_v3.relation_id, :version => relation_v3.version), :headers => auth_header
assert_response :forbidden, "After redaction, relation should be gone for moderator, when flag not passed."
- get relation_version_path(:id => relation_v3.relation_id, :version => relation_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header
+ get api_old_relation_path(:id => relation_v3.relation_id, :version => relation_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header
assert_response :success, "After redaction, relation should not be gone for moderator, when flag passed."
# and when accessed via history
auth_header = basic_authorization_header create(:user).email, "test"
# check can't see the redacted data
- get relation_version_path(:id => relation_v3.relation_id, :version => relation_v3.version), :headers => auth_header
+ get api_old_relation_path(:id => relation_v3.relation_id, :version => relation_v3.version), :headers => auth_header
assert_response :forbidden, "Redacted relation shouldn't be visible via the version API."
# and when accessed via history
# check moderator can still see the redacted data, without passing
# the appropriate flag
- get relation_version_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
+ get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
assert_response :success, "After unredaction, relation should not be gone for moderator."
# and when accessed via history
auth_header = basic_authorization_header create(:user).email, "test"
# check normal user can now see the redacted data
- get relation_version_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
+ get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
assert_response :success, "After redaction, node should not be gone for normal user."
# and when accessed via history
end
def do_redact_relation(relation, redaction, headers = {})
- get relation_version_path(:id => relation.relation_id, :version => relation.version)
+ get api_old_relation_path(:id => relation.relation_id, :version => relation.version)
assert_response :success, "should be able to get version #{relation.version} of relation #{relation.relation_id}."
# now redact it
way_v1 = way.old_ways.find_by(:version => 1)
way_v1.redact!(create(:redaction))
- get way_version_path(:id => way_v1.way_id, :version => way_v1.version)
+ get api_old_way_path(:id => way_v1.way_id, :version => way_v1.version)
assert_response :forbidden, "Redacted way shouldn't be visible via the version API."
# not even to a logged-in user
auth_header = basic_authorization_header create(:user).email, "test"
- get way_version_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
+ get api_old_way_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
assert_response :forbidden, "Redacted way shouldn't be visible via the version API, even when logged in."
end
# not even to a logged-in user
auth_header = basic_authorization_header create(:user).email, "test"
- get way_version_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
get api_way_history_path(:id => way_v1.way_id), :headers => auth_header
assert_response :success, "Redaction shouldn't have stopped history working."
assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 0,
# check moderator can still see the redacted data, when passing
# the appropriate flag
- get way_version_path(:id => way_v3.way_id, :version => way_v3.version), :headers => auth_header
+ get api_old_way_path(:id => way_v3.way_id, :version => way_v3.version), :headers => auth_header
assert_response :forbidden, "After redaction, node should be gone for moderator, when flag not passed."
- get way_version_path(:id => way_v3.way_id, :version => way_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header
+ get api_old_way_path(:id => way_v3.way_id, :version => way_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header
assert_response :success, "After redaction, node should not be gone for moderator, when flag passed."
# and when accessed via history
auth_header = basic_authorization_header create(:user).email, "test"
# check can't see the redacted data
- get way_version_path(:id => way_v3.way_id, :version => way_v3.version), :headers => auth_header
+ get api_old_way_path(:id => way_v3.way_id, :version => way_v3.version), :headers => auth_header
assert_response :forbidden, "Redacted node shouldn't be visible via the version API."
# and when accessed via history
# check moderator can still see the unredacted data, without passing
# the appropriate flag
- get way_version_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
+ get api_old_way_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
assert_response :success, "After unredaction, node should not be gone for moderator."
# and when accessed via history
auth_header = basic_authorization_header create(:user).email, "test"
# check normal user can now see the unredacted data
- get way_version_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
+ get api_old_way_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
assert_response :success, "After redaction, node should not be gone for moderator, when flag passed."
# and when accessed via history
assert_not_nil current_way, "getting way #{way_id} returned nil"
# get the "old" version of the way from the version method
- get way_version_path(:id => way_id, :version => current_way.version)
+ get api_old_way_path(:id => way_id, :version => current_way.version)
assert_response :success, "can't get old way #{way_id}, v#{current_way.version}"
old_way = Way.from_xml(@response.body)
history_way = Way.from_xml_node(way_doc)
assert_not_nil history_way, "parsing way #{way_id} version failed"
- get way_version_path(:id => way_id, :version => history_way.version)
+ get api_old_way_path(:id => way_id, :version => history_way.version)
assert_response :success, "couldn't get way #{way_id}, v#{history_way.version}"
version_way = Way.from_xml(@response.body)
assert_not_nil version_way, "failed to parse #{way_id}, v#{history_way.version}"
end
def do_redact_way(way, redaction, headers = {})
- get way_version_path(:id => way.way_id, :version => way.version)
+ get api_old_way_path(:id => way.way_id, :version => way.version)
assert_response :success, "should be able to get version #{way.version} of way #{way.way_id}."
# now redact it
# check the ordering in the history tables:
with_controller(OldRelationsController.new) do
- get relation_version_path(:id => relation_id, :version => 2)
+ get api_old_relation_path(:id => relation_id, :version => 2)
assert_response :success, "can't read back version 2 of the relation #{relation_id}"
check_ordering(doc, @response.body)
end
# check the ordering in the history tables:
with_controller(OldRelationsController.new) do
- get relation_version_path(:id => relation_id, :version => 1)
+ get api_old_relation_path(:id => relation_id, :version => 1)
assert_response :success, "can't read back version 1 of the relation: #{@response.body}"
check_ordering(doc, @response.body)
end
get api_relation_path(:id => id)
else
with_controller(OldRelationsController.new) do
- get relation_version_path(:id => id, :version => ver)
+ get api_old_relation_path(:id => id, :version => ver)
end
end
assert_response :success
assert_select "h4", /^Version/ do
assert_select "a[href='#{old_node_path node, 1}']", :count => 0
end
- assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 1
+ assert_select ".secondary-actions a[href='#{api_old_node_path node, 1}']", :count => 1
assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1
assert_select ".secondary-actions a[href='#{old_node_path node, 1, :params => { :show_redactions => true }}']", :count => 0
assert_select ".secondary-actions a[href='#{node_history_path node}']", :count => 1
assert_select "h4", /^Version/ do
assert_select "a[href='#{old_node_path node, 1}']", :count => 0
end
- assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 1
+ assert_select ".secondary-actions a[href='#{api_old_node_path node, 1}']", :count => 1
assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1
assert_select ".secondary-actions a[href='#{node_history_path node}']", :count => 1
assert_select ".secondary-actions a[href='#{old_node_path node, 2}']", :count => 1
assert_select "h4", /^Version/ do
assert_select "a[href='#{old_node_path node, 2}']", :count => 0
end
- assert_select ".secondary-actions a[href='#{node_version_path node, 2}']", :count => 1
+ assert_select ".secondary-actions a[href='#{api_old_node_path node, 2}']", :count => 1
assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1
assert_select ".secondary-actions a[href='#{node_history_path node}']", :count => 1
assert_select ".secondary-actions a[href='#{old_node_path node, 1}']", :count => 1
assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1
assert_select ".secondary-actions a[href='#{old_node_path node, 1, :params => { :show_redactions => true }}']", :count => 0
assert_select ".secondary-actions a[href='#{old_node_path node, 1}']", :count => 0
- assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 0
+ assert_select ".secondary-actions a[href='#{api_old_node_path node, 1}']", :count => 0
end
test "show unrevealed redacted versions to regular users" do
assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1
assert_select ".secondary-actions a[href='#{old_node_path node, 1, :params => { :show_redactions => true }}']", :count => 0
assert_select ".secondary-actions a[href='#{old_node_path node, 1}']", :count => 0
- assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 0
+ assert_select ".secondary-actions a[href='#{api_old_node_path node, 1}']", :count => 0
end
test "show unrevealed redacted versions to moderators" do
assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1
assert_select ".secondary-actions a[href='#{old_node_path node, 1, :params => { :show_redactions => true }}']", :count => 1
assert_select ".secondary-actions a[href='#{old_node_path node, 1}']", :count => 0
- assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 0
+ assert_select ".secondary-actions a[href='#{api_old_node_path node, 1}']", :count => 0
end
test "don't reveal redacted versions to anonymous users" do
assert_select "h4", /^Version/ do
assert_select "a[href='#{old_relation_path relation, 1}']", :count => 0
end
- assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 1
+ assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 1
assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1
assert_select ".secondary-actions a[href='#{old_relation_path relation, 1, :params => { :show_redactions => true }}']", :count => 0
assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1
assert_select "h4", /^Version/ do
assert_select "a[href='#{old_relation_path relation, 1}']", :count => 0
end
- assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 1
+ assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 1
assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1
assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1
assert_select ".secondary-actions a[href='#{old_relation_path relation, 2}']", :count => 1
assert_select "h4", /^Version/ do
assert_select "a[href='#{old_relation_path relation, 2}']", :count => 0
end
- assert_select ".secondary-actions a[href='#{relation_version_path relation, 2}']", :count => 1
+ assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 2}']", :count => 1
assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1
assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1
assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 1
assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1
assert_select ".secondary-actions a[href='#{old_relation_path relation, 1, :params => { :show_redactions => true }}']", :count => 0
assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 0
- assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 0
+ assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 0
end
test "show unrevealed redacted versions to regular users" do
assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1
assert_select ".secondary-actions a[href='#{old_relation_path relation, 1, :params => { :show_redactions => true }}']", :count => 0
assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 0
- assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 0
+ assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 0
end
test "show unrevealed redacted versions to moderators" do
assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1
assert_select ".secondary-actions a[href='#{old_relation_path relation, 1, :params => { :show_redactions => true }}']", :count => 1
assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 0
- assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 0
+ assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 0
end
test "don't reveal redacted versions to anonymous users" do
assert_select "h4", /^Version/ do
assert_select "a[href='#{old_way_path way, 1}']", :count => 0
end
- assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 1
+ assert_select ".secondary-actions a[href='#{api_old_way_path way, 1}']", :count => 1
assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1
assert_select ".secondary-actions a[href='#{old_way_path way, 1, :params => { :show_redactions => true }}']", :count => 0
assert_select ".secondary-actions a[href='#{way_history_path way}']", :count => 1
assert_select "h4", /^Version/ do
assert_select "a[href='#{old_way_path way, 1}']", :count => 0
end
- assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 1
+ assert_select ".secondary-actions a[href='#{api_old_way_path way, 1}']", :count => 1
assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1
assert_select ".secondary-actions a[href='#{way_history_path way}']", :count => 1
assert_select ".secondary-actions a[href='#{old_way_path way, 2}']", :count => 1
assert_select "h4", /^Version/ do
assert_select "a[href='#{old_way_path way, 2}']", :count => 0
end
- assert_select ".secondary-actions a[href='#{way_version_path way, 2}']", :count => 1
+ assert_select ".secondary-actions a[href='#{api_old_way_path way, 2}']", :count => 1
assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1
assert_select ".secondary-actions a[href='#{way_history_path way}']", :count => 1
assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 1
assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1
assert_select ".secondary-actions a[href='#{old_way_path way, 1, :params => { :show_redactions => true }}']", :count => 0
assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 0
- assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 0
+ assert_select ".secondary-actions a[href='#{api_old_way_path way, 1}']", :count => 0
end
test "show unrevealed redacted versions to regular users" do
assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1
assert_select ".secondary-actions a[href='#{old_way_path way, 1, :params => { :show_redactions => true }}']", :count => 0
assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 0
- assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 0
+ assert_select ".secondary-actions a[href='#{api_old_way_path way, 1}']", :count => 0
end
test "show unrevealed redacted versions to moderators" do
assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1
assert_select ".secondary-actions a[href='#{old_way_path way, 1, :params => { :show_redactions => true }}']", :count => 1
assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 0
- assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 0
+ assert_select ".secondary-actions a[href='#{api_old_way_path way, 1}']", :count => 0
end
test "don't reveal redacted versions to anonymous users" do