Merge remote-tracking branch 'upstream/pull/4641'
This commit is contained in:
commit
4fc1455d51
7 changed files with 117 additions and 117 deletions
|
@ -2436,7 +2436,7 @@ module Api
|
||||||
assert_response :success, "can't create a new node"
|
assert_response :success, "can't create a new node"
|
||||||
node_id = @response.body.to_i
|
node_id = @response.body.to_i
|
||||||
|
|
||||||
get api_node_path(:id => node_id)
|
get api_node_path(node_id)
|
||||||
assert_response :success, "can't read back new node"
|
assert_response :success, "can't read back new node"
|
||||||
node_doc = XML::Parser.string(@response.body).parse
|
node_doc = XML::Parser.string(@response.body).parse
|
||||||
node_xml = node_doc.find("//osm/node").first
|
node_xml = node_doc.find("//osm/node").first
|
||||||
|
@ -2447,7 +2447,7 @@ module Api
|
||||||
node_xml["lon"] = rand.to_s
|
node_xml["lon"] = rand.to_s
|
||||||
node_xml["version"] = (i + 1).to_s
|
node_xml["version"] = (i + 1).to_s
|
||||||
|
|
||||||
put api_node_path(:id => node_id), :params => node_doc.to_s, :headers => auth_header
|
put api_node_path(node_id), :params => node_doc.to_s, :headers => auth_header
|
||||||
assert_response :success, "attempt #{i} should have succeeded"
|
assert_response :success, "attempt #{i} should have succeeded"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2456,7 +2456,7 @@ module Api
|
||||||
node_xml["lon"] = rand.to_s
|
node_xml["lon"] = rand.to_s
|
||||||
node_xml["version"] = offset.to_s
|
node_xml["version"] = offset.to_s
|
||||||
|
|
||||||
put api_node_path(:id => node_id), :params => node_doc.to_s, :headers => auth_header
|
put api_node_path(node_id), :params => node_doc.to_s, :headers => auth_header
|
||||||
assert_response :conflict, "final attempt should have failed"
|
assert_response :conflict, "final attempt should have failed"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ module Api
|
||||||
assert_response :gone
|
assert_response :gone
|
||||||
|
|
||||||
# check chat a non-existent node is not returned
|
# check chat a non-existent node is not returned
|
||||||
get api_node_path(:id => 0)
|
get api_node_path(0)
|
||||||
assert_response :not_found
|
assert_response :not_found
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ module Api
|
||||||
assert_require_public_data
|
assert_require_public_data
|
||||||
|
|
||||||
# this won't work since the node never existed
|
# this won't work since the node never existed
|
||||||
delete api_node_path(:id => 0), :headers => auth_header
|
delete api_node_path(0), :headers => auth_header
|
||||||
assert_require_public_data
|
assert_require_public_data
|
||||||
|
|
||||||
## these test whether nodes which are in-use can be deleted:
|
## these test whether nodes which are in-use can be deleted:
|
||||||
|
@ -241,7 +241,7 @@ module Api
|
||||||
# try to delete a node with a different ID
|
# try to delete a node with a different ID
|
||||||
other_node = create(:node)
|
other_node = create(:node)
|
||||||
xml = xml_for_node(other_node)
|
xml = xml_for_node(other_node)
|
||||||
delete api_node_path(node.id), :params => xml.to_s, :headers => auth_header
|
delete api_node_path(node), :params => xml.to_s, :headers => auth_header
|
||||||
assert_response :bad_request,
|
assert_response :bad_request,
|
||||||
"should not be able to delete a node with a different ID from the XML"
|
"should not be able to delete a node with a different ID from the XML"
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ module Api
|
||||||
assert_response :gone
|
assert_response :gone
|
||||||
|
|
||||||
# this won't work since the node never existed
|
# this won't work since the node never existed
|
||||||
delete api_node_path(:id => 0), :headers => auth_header
|
delete api_node_path(0), :headers => auth_header
|
||||||
assert_response :not_found
|
assert_response :not_found
|
||||||
|
|
||||||
## these test whether nodes which are in-use can be deleted:
|
## these test whether nodes which are in-use can be deleted:
|
||||||
|
@ -360,7 +360,7 @@ module Api
|
||||||
# try and update a node without authorisation
|
# try and update a node without authorisation
|
||||||
# first try to update node without auth
|
# first try to update node without auth
|
||||||
xml = xml_for_node(node)
|
xml = xml_for_node(node)
|
||||||
put api_node_path(node.id), :params => xml.to_s, :headers => auth_header
|
put api_node_path(node), :params => xml.to_s, :headers => auth_header
|
||||||
assert_response :forbidden
|
assert_response :forbidden
|
||||||
|
|
||||||
# setup auth
|
# setup auth
|
||||||
|
@ -456,11 +456,11 @@ module Api
|
||||||
assert_response :bad_request
|
assert_response :bad_request
|
||||||
|
|
||||||
# check error when no parameter value provided
|
# check error when no parameter value provided
|
||||||
get nodes_path, :params => { :nodes => "" }
|
get nodes_path(:nodes => "")
|
||||||
assert_response :bad_request
|
assert_response :bad_request
|
||||||
|
|
||||||
# test a working call
|
# 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_response :success
|
||||||
assert_select "osm" do
|
assert_select "osm" do
|
||||||
assert_select "node", :count => 5
|
assert_select "node", :count => 5
|
||||||
|
@ -472,7 +472,7 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
# test a working call with json format
|
# 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)
|
js = ActiveSupport::JSON.decode(@response.body)
|
||||||
assert_not_nil js
|
assert_not_nil js
|
||||||
|
@ -485,7 +485,7 @@ module Api
|
||||||
assert_equal 1, (js["elements"].count { |a| a["id"] == node5.id && a["visible"] == false })
|
assert_equal 1, (js["elements"].count { |a| a["id"] == node5.id && a["visible"] == false })
|
||||||
|
|
||||||
# check error when a non-existent node is included
|
# 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
|
assert_response :not_found
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ module Api
|
||||||
assert_not_nil checknode, "node not found in data base after upload"
|
assert_not_nil checknode, "node not found in data base after upload"
|
||||||
|
|
||||||
# and grab it using the api
|
# and grab it using the api
|
||||||
get api_node_path(:id => nodeid)
|
get api_node_path(nodeid)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
apinode = Node.from_xml(@response.body)
|
apinode = Node.from_xml(@response.body)
|
||||||
assert_not_nil apinode, "downloaded node is nil, but shouldn't be"
|
assert_not_nil apinode, "downloaded node is nil, but shouldn't be"
|
||||||
|
|
|
@ -68,7 +68,7 @@ module Api
|
||||||
xml_node["lat"] = precision((rand * 180) - 90).to_s
|
xml_node["lat"] = precision((rand * 180) - 90).to_s
|
||||||
xml_node["lon"] = precision((rand * 360) - 180).to_s
|
xml_node["lon"] = precision((rand * 360) - 180).to_s
|
||||||
with_controller(NodesController.new) do
|
with_controller(NodesController.new) do
|
||||||
put api_node_path(:id => nodeid), :params => xml_doc.to_s, :headers => auth_header
|
put api_node_path(nodeid), :params => xml_doc.to_s, :headers => auth_header
|
||||||
assert_response :forbidden, "Should have rejected node update"
|
assert_response :forbidden, "Should have rejected node update"
|
||||||
xml_node["version"] = @response.body.to_s
|
xml_node["version"] = @response.body.to_s
|
||||||
end
|
end
|
||||||
|
@ -83,7 +83,7 @@ module Api
|
||||||
xml_tag["v"] = random_string
|
xml_tag["v"] = random_string
|
||||||
xml_node << xml_tag
|
xml_node << xml_tag
|
||||||
with_controller(NodesController.new) do
|
with_controller(NodesController.new) do
|
||||||
put api_node_path(:id => nodeid), :params => xml_doc.to_s, :headers => auth_header
|
put api_node_path(nodeid), :params => xml_doc.to_s, :headers => auth_header
|
||||||
assert_response :forbidden,
|
assert_response :forbidden,
|
||||||
"should have rejected node #{nodeid} (#{@response.body}) with forbidden"
|
"should have rejected node #{nodeid} (#{@response.body}) with forbidden"
|
||||||
xml_node["version"] = @response.body.to_s
|
xml_node["version"] = @response.body.to_s
|
||||||
|
@ -116,7 +116,7 @@ module Api
|
||||||
xml_node["lat"] = precision((rand * 180) - 90).to_s
|
xml_node["lat"] = precision((rand * 180) - 90).to_s
|
||||||
xml_node["lon"] = precision((rand * 360) - 180).to_s
|
xml_node["lon"] = precision((rand * 360) - 180).to_s
|
||||||
with_controller(NodesController.new) do
|
with_controller(NodesController.new) do
|
||||||
put api_node_path(:id => nodeid), :params => xml_doc.to_s, :headers => auth_header
|
put api_node_path(nodeid), :params => xml_doc.to_s, :headers => auth_header
|
||||||
assert_response :success
|
assert_response :success
|
||||||
xml_node["version"] = @response.body.to_s
|
xml_node["version"] = @response.body.to_s
|
||||||
end
|
end
|
||||||
|
@ -131,7 +131,7 @@ module Api
|
||||||
xml_tag["v"] = random_string
|
xml_tag["v"] = random_string
|
||||||
xml_node << xml_tag
|
xml_node << xml_tag
|
||||||
with_controller(NodesController.new) do
|
with_controller(NodesController.new) do
|
||||||
put api_node_path(:id => nodeid), :params => xml_doc.to_s, :headers => auth_header
|
put api_node_path(nodeid), :params => xml_doc.to_s, :headers => auth_header
|
||||||
assert_response :success,
|
assert_response :success,
|
||||||
"couldn't update node #{nodeid} (#{@response.body})"
|
"couldn't update node #{nodeid} (#{@response.body})"
|
||||||
xml_node["version"] = @response.body.to_s
|
xml_node["version"] = @response.body.to_s
|
||||||
|
@ -142,7 +142,7 @@ module Api
|
||||||
|
|
||||||
# check all the versions
|
# check all the versions
|
||||||
versions.each_key do |key|
|
versions.each_key do |key|
|
||||||
get api_old_node_path(:id => nodeid, :version => key.to_i)
|
get api_old_node_path(nodeid, key.to_i)
|
||||||
|
|
||||||
assert_response :success,
|
assert_response :success,
|
||||||
"couldn't get version #{key.to_i} of node #{nodeid}"
|
"couldn't get version #{key.to_i} of node #{nodeid}"
|
||||||
|
@ -191,7 +191,7 @@ module Api
|
||||||
def test_lat_lon_xml_format
|
def test_lat_lon_xml_format
|
||||||
old_node = create(:old_node, :latitude => (0.00004 * OldNode::SCALE).to_i, :longitude => (0.00008 * OldNode::SCALE).to_i)
|
old_node = create(:old_node, :latitude => (0.00004 * OldNode::SCALE).to_i, :longitude => (0.00008 * OldNode::SCALE).to_i)
|
||||||
|
|
||||||
get api_node_history_path(:id => old_node.node_id, :version => old_node.version)
|
get api_node_history_path(old_node.node_id)
|
||||||
assert_match(/lat="0.0000400"/, response.body)
|
assert_match(/lat="0.0000400"/, response.body)
|
||||||
assert_match(/lon="0.0000800"/, response.body)
|
assert_match(/lon="0.0000800"/, response.body)
|
||||||
end
|
end
|
||||||
|
@ -283,12 +283,12 @@ module Api
|
||||||
node_v1 = node.old_nodes.find_by(:version => 1)
|
node_v1 = node.old_nodes.find_by(:version => 1)
|
||||||
node_v1.redact!(create(:redaction))
|
node_v1.redact!(create(:redaction))
|
||||||
|
|
||||||
get api_old_node_path(:id => node_v1.node_id, :version => node_v1.version)
|
get api_old_node_path(node_v1.node_id, node_v1.version)
|
||||||
assert_response :forbidden, "Redacted node shouldn't be visible via the version API."
|
assert_response :forbidden, "Redacted node shouldn't be visible via the version API."
|
||||||
|
|
||||||
# not even to a logged-in user
|
# not even to a logged-in user
|
||||||
auth_header = basic_authorization_header create(:user).email, "test"
|
auth_header = basic_authorization_header create(:user).email, "test"
|
||||||
get api_old_node_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header
|
get api_old_node_path(node_v1.node_id, node_v1.version), :headers => auth_header
|
||||||
assert_response :forbidden, "Redacted node shouldn't be visible via the version API, even when logged in."
|
assert_response :forbidden, "Redacted node shouldn't be visible via the version API, even when logged in."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -299,14 +299,14 @@ module Api
|
||||||
node_v1 = node.old_nodes.find_by(:version => 1)
|
node_v1 = node.old_nodes.find_by(:version => 1)
|
||||||
node_v1.redact!(create(:redaction))
|
node_v1.redact!(create(:redaction))
|
||||||
|
|
||||||
get api_node_history_path(:id => node_v1.node_id)
|
get api_node_history_path(node)
|
||||||
assert_response :success, "Redaction shouldn't have stopped history working."
|
assert_response :success, "Redaction shouldn't have stopped history working."
|
||||||
assert_select "osm node[id='#{node_v1.node_id}'][version='#{node_v1.version}']", 0,
|
assert_select "osm node[id='#{node_v1.node_id}'][version='#{node_v1.version}']", 0,
|
||||||
"redacted node #{node_v1.node_id} version #{node_v1.version} shouldn't be present in the history."
|
"redacted node #{node_v1.node_id} version #{node_v1.version} shouldn't be present in the history."
|
||||||
|
|
||||||
# not even to a logged-in user
|
# not even to a logged-in user
|
||||||
auth_header = basic_authorization_header create(:user).email, "test"
|
auth_header = basic_authorization_header create(:user).email, "test"
|
||||||
get api_node_history_path(:id => node_v1.node_id), :headers => auth_header
|
get api_node_history_path(node), :headers => auth_header
|
||||||
assert_response :success, "Redaction shouldn't have stopped history working."
|
assert_response :success, "Redaction shouldn't have stopped history working."
|
||||||
assert_select "osm node[id='#{node_v1.node_id}'][version='#{node_v1.version}']", 0,
|
assert_select "osm node[id='#{node_v1.node_id}'][version='#{node_v1.version}']", 0,
|
||||||
"redacted node #{node_v1.node_id} version #{node_v1.version} shouldn't be present in the history, even when logged in."
|
"redacted node #{node_v1.node_id} version #{node_v1.version} shouldn't be present in the history, even when logged in."
|
||||||
|
@ -325,17 +325,17 @@ module Api
|
||||||
|
|
||||||
# check moderator can still see the redacted data, when passing
|
# check moderator can still see the redacted data, when passing
|
||||||
# the appropriate flag
|
# the appropriate flag
|
||||||
get api_old_node_path(:id => node_v3.node_id, :version => node_v3.version), :headers => auth_header
|
get api_old_node_path(node_v3.node_id, node_v3.version), :headers => auth_header
|
||||||
assert_response :forbidden, "After redaction, node should be gone for moderator, when flag not passed."
|
assert_response :forbidden, "After redaction, node should be gone for moderator, when flag not passed."
|
||||||
get api_old_node_path(:id => node_v3.node_id, :version => node_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header
|
get api_old_node_path(node_v3.node_id, node_v3.version, :show_redactions => "true"), :headers => auth_header
|
||||||
assert_response :success, "After redaction, node should not be gone for moderator, when flag passed."
|
assert_response :success, "After redaction, node should not be gone for moderator, when flag passed."
|
||||||
|
|
||||||
# and when accessed via history
|
# and when accessed via history
|
||||||
get api_node_history_path(:id => node_v3.node_id)
|
get api_node_history_path(node)
|
||||||
assert_response :success, "Redaction shouldn't have stopped history working."
|
assert_response :success, "Redaction shouldn't have stopped history working."
|
||||||
assert_select "osm node[id='#{node_v3.node_id}'][version='#{node_v3.version}']", 0,
|
assert_select "osm node[id='#{node_v3.node_id}'][version='#{node_v3.version}']", 0,
|
||||||
"node #{node_v3.node_id} version #{node_v3.version} should not be present in the history for moderators when not passing flag."
|
"node #{node_v3.node_id} version #{node_v3.version} should not be present in the history for moderators when not passing flag."
|
||||||
get api_node_history_path(:id => node_v3.node_id), :params => { :show_redactions => "true" }, :headers => auth_header
|
get api_node_history_path(node, :show_redactions => "true"), :headers => auth_header
|
||||||
assert_response :success, "Redaction shouldn't have stopped history working."
|
assert_response :success, "Redaction shouldn't have stopped history working."
|
||||||
assert_select "osm node[id='#{node_v3.node_id}'][version='#{node_v3.version}']", 1,
|
assert_select "osm node[id='#{node_v3.node_id}'][version='#{node_v3.version}']", 1,
|
||||||
"node #{node_v3.node_id} version #{node_v3.version} should still be present in the history for moderators when passing flag."
|
"node #{node_v3.node_id} version #{node_v3.version} should still be present in the history for moderators when passing flag."
|
||||||
|
@ -355,11 +355,11 @@ module Api
|
||||||
auth_header = basic_authorization_header create(:user).email, "test"
|
auth_header = basic_authorization_header create(:user).email, "test"
|
||||||
|
|
||||||
# check can't see the redacted data
|
# check can't see the redacted data
|
||||||
get api_old_node_path(:id => node_v3.node_id, :version => node_v3.version), :headers => auth_header
|
get api_old_node_path(node_v3.node_id, node_v3.version), :headers => auth_header
|
||||||
assert_response :forbidden, "Redacted node shouldn't be visible via the version API."
|
assert_response :forbidden, "Redacted node shouldn't be visible via the version API."
|
||||||
|
|
||||||
# and when accessed via history
|
# and when accessed via history
|
||||||
get api_node_history_path(:id => node_v3.node_id), :headers => auth_header
|
get api_node_history_path(node), :headers => auth_header
|
||||||
assert_response :success, "Redaction shouldn't have stopped history working."
|
assert_response :success, "Redaction shouldn't have stopped history working."
|
||||||
assert_select "osm node[id='#{node_v3.node_id}'][version='#{node_v3.version}']", 0,
|
assert_select "osm node[id='#{node_v3.node_id}'][version='#{node_v3.version}']", 0,
|
||||||
"redacted node #{node_v3.node_id} version #{node_v3.version} shouldn't be present in the history."
|
"redacted node #{node_v3.node_id} version #{node_v3.version} shouldn't be present in the history."
|
||||||
|
@ -373,7 +373,7 @@ module Api
|
||||||
node_v1 = node.old_nodes.find_by(:version => 1)
|
node_v1 = node.old_nodes.find_by(:version => 1)
|
||||||
node_v1.redact!(create(:redaction))
|
node_v1.redact!(create(:redaction))
|
||||||
|
|
||||||
post node_version_redact_path(:id => node_v1.node_id, :version => node_v1.version)
|
post node_version_redact_path(node_v1.node_id, node_v1.version)
|
||||||
assert_response :unauthorized, "should need to be authenticated to unredact."
|
assert_response :unauthorized, "should need to be authenticated to unredact."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ module Api
|
||||||
|
|
||||||
auth_header = basic_authorization_header user.email, "test"
|
auth_header = basic_authorization_header user.email, "test"
|
||||||
|
|
||||||
post node_version_redact_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header
|
post node_version_redact_path(node_v1.node_id, node_v1.version), :headers => auth_header
|
||||||
assert_response :forbidden, "should need to be moderator to unredact."
|
assert_response :forbidden, "should need to be moderator to unredact."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -403,16 +403,16 @@ module Api
|
||||||
|
|
||||||
auth_header = basic_authorization_header moderator_user.email, "test"
|
auth_header = basic_authorization_header moderator_user.email, "test"
|
||||||
|
|
||||||
post node_version_redact_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header
|
post node_version_redact_path(node_v1.node_id, node_v1.version), :headers => auth_header
|
||||||
assert_response :success, "should be OK to unredact old version as moderator."
|
assert_response :success, "should be OK to unredact old version as moderator."
|
||||||
|
|
||||||
# check moderator can now see the redacted data, when not
|
# check moderator can now see the redacted data, when not
|
||||||
# passing the aspecial flag
|
# passing the aspecial flag
|
||||||
get api_old_node_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header
|
get api_old_node_path(node_v1.node_id, node_v1.version), :headers => auth_header
|
||||||
assert_response :success, "After unredaction, node should not be gone for moderator."
|
assert_response :success, "After unredaction, node should not be gone for moderator."
|
||||||
|
|
||||||
# and when accessed via history
|
# and when accessed via history
|
||||||
get api_node_history_path(:id => node_v1.node_id)
|
get api_node_history_path(node)
|
||||||
assert_response :success, "Unredaction shouldn't have stopped history working."
|
assert_response :success, "Unredaction shouldn't have stopped history working."
|
||||||
assert_select "osm node[id='#{node_v1.node_id}'][version='#{node_v1.version}']", 1,
|
assert_select "osm node[id='#{node_v1.node_id}'][version='#{node_v1.version}']", 1,
|
||||||
"node #{node_v1.node_id} version #{node_v1.version} should now be present in the history for moderators without passing flag."
|
"node #{node_v1.node_id} version #{node_v1.version} should now be present in the history for moderators without passing flag."
|
||||||
|
@ -420,11 +420,11 @@ module Api
|
||||||
auth_header = basic_authorization_header create(:user).email, "test"
|
auth_header = basic_authorization_header create(:user).email, "test"
|
||||||
|
|
||||||
# check normal user can now see the redacted data
|
# check normal user can now see the redacted data
|
||||||
get api_old_node_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header
|
get api_old_node_path(node_v1.node_id, node_v1.version), :headers => auth_header
|
||||||
assert_response :success, "After unredaction, node should be visible to normal users."
|
assert_response :success, "After unredaction, node should be visible to normal users."
|
||||||
|
|
||||||
# and when accessed via history
|
# and when accessed via history
|
||||||
get api_node_history_path(:id => node_v1.node_id)
|
get api_node_history_path(node)
|
||||||
assert_response :success, "Unredaction shouldn't have stopped history working."
|
assert_response :success, "Unredaction shouldn't have stopped history working."
|
||||||
assert_select "osm node[id='#{node_v1.node_id}'][version='#{node_v1.version}']", 1,
|
assert_select "osm node[id='#{node_v1.node_id}'][version='#{node_v1.version}']", 1,
|
||||||
"node #{node_v1.node_id} version #{node_v1.version} should now be present in the history for normal users without passing flag."
|
"node #{node_v1.node_id} version #{node_v1.version} should now be present in the history for normal users without passing flag."
|
||||||
|
@ -446,24 +446,24 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
def do_redact_node(node, redaction, headers = {})
|
def do_redact_node(node, redaction, headers = {})
|
||||||
get api_old_node_path(:id => node.node_id, :version => node.version), :headers => headers
|
get api_old_node_path(node.node_id, node.version), :headers => headers
|
||||||
assert_response :success, "should be able to get version #{node.version} of node #{node.node_id}."
|
assert_response :success, "should be able to get version #{node.version} of node #{node.node_id}."
|
||||||
|
|
||||||
# now redact it
|
# now redact it
|
||||||
post node_version_redact_path(:id => node.node_id, :version => node.version), :params => { :redaction => redaction.id }, :headers => headers
|
post node_version_redact_path(node.node_id, node.version), :params => { :redaction => redaction.id }, :headers => headers
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_current_version(node_id)
|
def check_current_version(node_id)
|
||||||
# get the current version of the node
|
# get the current version of the node
|
||||||
current_node = with_controller(NodesController.new) do
|
current_node = with_controller(NodesController.new) do
|
||||||
get api_node_path(:id => node_id)
|
get api_node_path(node_id)
|
||||||
assert_response :success, "cant get current node #{node_id}"
|
assert_response :success, "cant get current node #{node_id}"
|
||||||
Node.from_xml(@response.body)
|
Node.from_xml(@response.body)
|
||||||
end
|
end
|
||||||
assert_not_nil current_node, "getting node #{node_id} returned nil"
|
assert_not_nil current_node, "getting node #{node_id} returned nil"
|
||||||
|
|
||||||
# get the "old" version of the node from the old_node interface
|
# get the "old" version of the node from the old_node interface
|
||||||
get api_old_node_path(:id => node_id, :version => current_node.version)
|
get api_old_node_path(node_id, current_node.version)
|
||||||
assert_response :success, "cant get old node #{node_id}, v#{current_node.version}"
|
assert_response :success, "cant get old node #{node_id}, v#{current_node.version}"
|
||||||
old_node = Node.from_xml(@response.body)
|
old_node = Node.from_xml(@response.body)
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_not_found_id_version(id, version)
|
def check_not_found_id_version(id, version)
|
||||||
get api_old_node_path(:id => id, :version => version)
|
get api_old_node_path(id, version)
|
||||||
assert_response :not_found
|
assert_response :not_found
|
||||||
rescue ActionController::UrlGenerationError => e
|
rescue ActionController::UrlGenerationError => e
|
||||||
assert_match(/No route matches/, e.to_s)
|
assert_match(/No route matches/, e.to_s)
|
||||||
|
|
|
@ -36,7 +36,7 @@ module Api
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
# check chat a non-existent relations is not returned
|
# check chat a non-existent relations is not returned
|
||||||
get api_relation_history_path(:id => 0)
|
get api_relation_history_path(0)
|
||||||
assert_response :not_found
|
assert_response :not_found
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -122,12 +122,12 @@ module Api
|
||||||
relation_v1 = relation.old_relations.find_by(:version => 1)
|
relation_v1 = relation.old_relations.find_by(:version => 1)
|
||||||
relation_v1.redact!(create(:redaction))
|
relation_v1.redact!(create(:redaction))
|
||||||
|
|
||||||
get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version)
|
get api_old_relation_path(relation_v1.relation_id, relation_v1.version)
|
||||||
assert_response :forbidden, "Redacted relation shouldn't be visible via the version API."
|
assert_response :forbidden, "Redacted relation shouldn't be visible via the version API."
|
||||||
|
|
||||||
# not even to a logged-in user
|
# not even to a logged-in user
|
||||||
auth_header = basic_authorization_header create(:user).email, "test"
|
auth_header = basic_authorization_header create(:user).email, "test"
|
||||||
get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
|
get api_old_relation_path(relation_v1.relation_id, relation_v1.version), :headers => auth_header
|
||||||
assert_response :forbidden, "Redacted relation shouldn't be visible via the version API, even when logged in."
|
assert_response :forbidden, "Redacted relation shouldn't be visible via the version API, even when logged in."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -138,15 +138,15 @@ module Api
|
||||||
relation_v1 = relation.old_relations.find_by(:version => 1)
|
relation_v1 = relation.old_relations.find_by(:version => 1)
|
||||||
relation_v1.redact!(create(:redaction))
|
relation_v1.redact!(create(:redaction))
|
||||||
|
|
||||||
get api_relation_history_path(:id => relation_v1.relation_id)
|
get api_relation_history_path(relation)
|
||||||
assert_response :success, "Redaction shouldn't have stopped history working."
|
assert_response :success, "Redaction shouldn't have stopped history working."
|
||||||
assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 0,
|
assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 0,
|
||||||
"redacted relation #{relation_v1.relation_id} version #{relation_v1.version} shouldn't be present in the history."
|
"redacted relation #{relation_v1.relation_id} version #{relation_v1.version} shouldn't be present in the history."
|
||||||
|
|
||||||
# not even to a logged-in user
|
# not even to a logged-in user
|
||||||
auth_header = basic_authorization_header create(:user).email, "test"
|
auth_header = basic_authorization_header create(:user).email, "test"
|
||||||
get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
|
get api_old_relation_path(relation_v1.relation_id, relation_v1.version), :headers => auth_header
|
||||||
get api_relation_history_path(:id => relation_v1.relation_id), :headers => auth_header
|
get api_relation_history_path(relation), :headers => auth_header
|
||||||
assert_response :success, "Redaction shouldn't have stopped history working."
|
assert_response :success, "Redaction shouldn't have stopped history working."
|
||||||
assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 0,
|
assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 0,
|
||||||
"redacted relation #{relation_v1.relation_id} version #{relation_v1.version} shouldn't be present in the history, even when logged in."
|
"redacted relation #{relation_v1.relation_id} version #{relation_v1.version} shouldn't be present in the history, even when logged in."
|
||||||
|
@ -166,17 +166,17 @@ module Api
|
||||||
|
|
||||||
# check moderator can still see the redacted data, when passing
|
# check moderator can still see the redacted data, when passing
|
||||||
# the appropriate flag
|
# the appropriate flag
|
||||||
get api_old_relation_path(:id => relation_v3.relation_id, :version => relation_v3.version), :headers => auth_header
|
get api_old_relation_path(relation_v3.relation_id, relation_v3.version), :headers => auth_header
|
||||||
assert_response :forbidden, "After redaction, relation should be gone for moderator, when flag not passed."
|
assert_response :forbidden, "After redaction, relation should be gone for moderator, when flag not passed."
|
||||||
get api_old_relation_path(:id => relation_v3.relation_id, :version => relation_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header
|
get api_old_relation_path(relation_v3.relation_id, relation_v3.version, :show_redactions => "true"), :headers => auth_header
|
||||||
assert_response :success, "After redaction, relation should not be gone for moderator, when flag passed."
|
assert_response :success, "After redaction, relation should not be gone for moderator, when flag passed."
|
||||||
|
|
||||||
# and when accessed via history
|
# and when accessed via history
|
||||||
get api_relation_history_path(:id => relation_v3.relation_id), :headers => auth_header
|
get api_relation_history_path(relation), :headers => auth_header
|
||||||
assert_response :success, "Redaction shouldn't have stopped history working."
|
assert_response :success, "Redaction shouldn't have stopped history working."
|
||||||
assert_select "osm relation[id='#{relation_v3.relation_id}'][version='#{relation_v3.version}']", 0,
|
assert_select "osm relation[id='#{relation_v3.relation_id}'][version='#{relation_v3.version}']", 0,
|
||||||
"relation #{relation_v3.relation_id} version #{relation_v3.version} should not be present in the history for moderators when not passing flag."
|
"relation #{relation_v3.relation_id} version #{relation_v3.version} should not be present in the history for moderators when not passing flag."
|
||||||
get api_relation_history_path(:id => relation_v3.relation_id), :params => { :show_redactions => "true" }, :headers => auth_header
|
get api_relation_history_path(relation, :show_redactions => "true"), :headers => auth_header
|
||||||
assert_response :success, "Redaction shouldn't have stopped history working."
|
assert_response :success, "Redaction shouldn't have stopped history working."
|
||||||
assert_select "osm relation[id='#{relation_v3.relation_id}'][version='#{relation_v3.version}']", 1,
|
assert_select "osm relation[id='#{relation_v3.relation_id}'][version='#{relation_v3.version}']", 1,
|
||||||
"relation #{relation_v3.relation_id} version #{relation_v3.version} should still be present in the history for moderators when passing flag."
|
"relation #{relation_v3.relation_id} version #{relation_v3.version} should still be present in the history for moderators when passing flag."
|
||||||
|
@ -197,11 +197,11 @@ module Api
|
||||||
auth_header = basic_authorization_header create(:user).email, "test"
|
auth_header = basic_authorization_header create(:user).email, "test"
|
||||||
|
|
||||||
# check can't see the redacted data
|
# check can't see the redacted data
|
||||||
get api_old_relation_path(:id => relation_v3.relation_id, :version => relation_v3.version), :headers => auth_header
|
get api_old_relation_path(relation_v3.relation_id, relation_v3.version), :headers => auth_header
|
||||||
assert_response :forbidden, "Redacted relation shouldn't be visible via the version API."
|
assert_response :forbidden, "Redacted relation shouldn't be visible via the version API."
|
||||||
|
|
||||||
# and when accessed via history
|
# and when accessed via history
|
||||||
get api_relation_history_path(:id => relation_v3.relation_id), :headers => auth_header
|
get api_relation_history_path(relation), :headers => auth_header
|
||||||
assert_response :success, "Redaction shouldn't have stopped history working."
|
assert_response :success, "Redaction shouldn't have stopped history working."
|
||||||
assert_select "osm relation[id='#{relation_v3.relation_id}'][version='#{relation_v3.version}']", 0,
|
assert_select "osm relation[id='#{relation_v3.relation_id}'][version='#{relation_v3.version}']", 0,
|
||||||
"redacted relation #{relation_v3.relation_id} version #{relation_v3.version} shouldn't be present in the history."
|
"redacted relation #{relation_v3.relation_id} version #{relation_v3.version} shouldn't be present in the history."
|
||||||
|
@ -215,7 +215,7 @@ module Api
|
||||||
relation_v1 = relation.old_relations.find_by(:version => 1)
|
relation_v1 = relation.old_relations.find_by(:version => 1)
|
||||||
relation_v1.redact!(create(:redaction))
|
relation_v1.redact!(create(:redaction))
|
||||||
|
|
||||||
post relation_version_redact_path(:id => relation_v1.relation_id, :version => relation_v1.version)
|
post relation_version_redact_path(relation_v1.relation_id, relation_v1.version)
|
||||||
assert_response :unauthorized, "should need to be authenticated to unredact."
|
assert_response :unauthorized, "should need to be authenticated to unredact."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ module Api
|
||||||
|
|
||||||
auth_header = basic_authorization_header create(:user).email, "test"
|
auth_header = basic_authorization_header create(:user).email, "test"
|
||||||
|
|
||||||
post relation_version_redact_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
|
post relation_version_redact_path(relation_v1.relation_id, relation_v1.version), :headers => auth_header
|
||||||
assert_response :forbidden, "should need to be moderator to unredact."
|
assert_response :forbidden, "should need to be moderator to unredact."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -243,16 +243,16 @@ module Api
|
||||||
|
|
||||||
auth_header = basic_authorization_header create(:moderator_user).email, "test"
|
auth_header = basic_authorization_header create(:moderator_user).email, "test"
|
||||||
|
|
||||||
post relation_version_redact_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
|
post relation_version_redact_path(relation_v1.relation_id, relation_v1.version), :headers => auth_header
|
||||||
assert_response :success, "should be OK to unredact old version as moderator."
|
assert_response :success, "should be OK to unredact old version as moderator."
|
||||||
|
|
||||||
# check moderator can still see the redacted data, without passing
|
# check moderator can still see the redacted data, without passing
|
||||||
# the appropriate flag
|
# the appropriate flag
|
||||||
get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
|
get api_old_relation_path(relation_v1.relation_id, relation_v1.version), :headers => auth_header
|
||||||
assert_response :success, "After unredaction, relation should not be gone for moderator."
|
assert_response :success, "After unredaction, relation should not be gone for moderator."
|
||||||
|
|
||||||
# and when accessed via history
|
# and when accessed via history
|
||||||
get api_relation_history_path(:id => relation_v1.relation_id), :headers => auth_header
|
get api_relation_history_path(relation), :headers => auth_header
|
||||||
assert_response :success, "Redaction shouldn't have stopped history working."
|
assert_response :success, "Redaction shouldn't have stopped history working."
|
||||||
assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 1,
|
assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 1,
|
||||||
"relation #{relation_v1.relation_id} version #{relation_v1.version} should still be present in the history for moderators."
|
"relation #{relation_v1.relation_id} version #{relation_v1.version} should still be present in the history for moderators."
|
||||||
|
@ -260,11 +260,11 @@ module Api
|
||||||
auth_header = basic_authorization_header create(:user).email, "test"
|
auth_header = basic_authorization_header create(:user).email, "test"
|
||||||
|
|
||||||
# check normal user can now see the redacted data
|
# check normal user can now see the redacted data
|
||||||
get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
|
get api_old_relation_path(relation_v1.relation_id, relation_v1.version), :headers => auth_header
|
||||||
assert_response :success, "After redaction, node should not be gone for normal user."
|
assert_response :success, "After redaction, node should not be gone for normal user."
|
||||||
|
|
||||||
# and when accessed via history
|
# and when accessed via history
|
||||||
get api_relation_history_path(:id => relation_v1.relation_id), :headers => auth_header
|
get api_relation_history_path(relation), :headers => auth_header
|
||||||
assert_response :success, "Redaction shouldn't have stopped history working."
|
assert_response :success, "Redaction shouldn't have stopped history working."
|
||||||
assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 1,
|
assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 1,
|
||||||
"relation #{relation_v1.relation_id} version #{relation_v1.version} should still be present in the history for normal users."
|
"relation #{relation_v1.relation_id} version #{relation_v1.version} should still be present in the history for normal users."
|
||||||
|
@ -329,11 +329,11 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
def do_redact_relation(relation, redaction, headers = {})
|
def do_redact_relation(relation, redaction, headers = {})
|
||||||
get api_old_relation_path(:id => relation.relation_id, :version => relation.version)
|
get api_old_relation_path(relation.relation_id, relation.version)
|
||||||
assert_response :success, "should be able to get version #{relation.version} of relation #{relation.relation_id}."
|
assert_response :success, "should be able to get version #{relation.version} of relation #{relation.relation_id}."
|
||||||
|
|
||||||
# now redact it
|
# now redact it
|
||||||
post relation_version_redact_path(:id => relation.relation_id, :version => relation.version), :params => { :redaction => redaction.id }, :headers => headers
|
post relation_version_redact_path(relation.relation_id, relation.version), :params => { :redaction => redaction.id }, :headers => headers
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -45,7 +45,7 @@ module Api
|
||||||
|
|
||||||
def test_history_invalid
|
def test_history_invalid
|
||||||
# check chat a non-existent way is not returned
|
# check chat a non-existent way is not returned
|
||||||
get api_way_history_path(:id => 0)
|
get api_way_history_path(0)
|
||||||
assert_response :not_found
|
assert_response :not_found
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -163,12 +163,12 @@ module Api
|
||||||
way_v1 = way.old_ways.find_by(:version => 1)
|
way_v1 = way.old_ways.find_by(:version => 1)
|
||||||
way_v1.redact!(create(:redaction))
|
way_v1.redact!(create(:redaction))
|
||||||
|
|
||||||
get api_old_way_path(:id => way_v1.way_id, :version => way_v1.version)
|
get api_old_way_path(way_v1.way_id, way_v1.version)
|
||||||
assert_response :forbidden, "Redacted way shouldn't be visible via the version API."
|
assert_response :forbidden, "Redacted way shouldn't be visible via the version API."
|
||||||
|
|
||||||
# not even to a logged-in user
|
# not even to a logged-in user
|
||||||
auth_header = basic_authorization_header create(:user).email, "test"
|
auth_header = basic_authorization_header create(:user).email, "test"
|
||||||
get api_old_way_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
|
get api_old_way_path(way_v1.way_id, way_v1.version), :headers => auth_header
|
||||||
assert_response :forbidden, "Redacted way shouldn't be visible via the version API, even when logged in."
|
assert_response :forbidden, "Redacted way shouldn't be visible via the version API, even when logged in."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -179,14 +179,14 @@ module Api
|
||||||
way_v1 = way.old_ways.find_by(:version => 1)
|
way_v1 = way.old_ways.find_by(:version => 1)
|
||||||
way_v1.redact!(create(:redaction))
|
way_v1.redact!(create(:redaction))
|
||||||
|
|
||||||
get api_way_history_path(:id => way_v1.way_id)
|
get api_way_history_path(way)
|
||||||
assert_response :success, "Redaction shouldn't have stopped history working."
|
assert_response :success, "Redaction shouldn't have stopped history working."
|
||||||
assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 0,
|
assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 0,
|
||||||
"redacted way #{way_v1.way_id} version #{way_v1.version} shouldn't be present in the history."
|
"redacted way #{way_v1.way_id} version #{way_v1.version} shouldn't be present in the history."
|
||||||
|
|
||||||
# not even to a logged-in user
|
# not even to a logged-in user
|
||||||
auth_header = basic_authorization_header create(:user).email, "test"
|
auth_header = basic_authorization_header create(:user).email, "test"
|
||||||
get api_way_history_path(:id => way_v1.way_id), :headers => auth_header
|
get api_way_history_path(way), :headers => auth_header
|
||||||
assert_response :success, "Redaction shouldn't have stopped history working."
|
assert_response :success, "Redaction shouldn't have stopped history working."
|
||||||
assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 0,
|
assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 0,
|
||||||
"redacted node #{way_v1.way_id} version #{way_v1.version} shouldn't be present in the history, even when logged in."
|
"redacted node #{way_v1.way_id} version #{way_v1.version} shouldn't be present in the history, even when logged in."
|
||||||
|
@ -205,17 +205,17 @@ module Api
|
||||||
|
|
||||||
# check moderator can still see the redacted data, when passing
|
# check moderator can still see the redacted data, when passing
|
||||||
# the appropriate flag
|
# the appropriate flag
|
||||||
get api_old_way_path(:id => way_v3.way_id, :version => way_v3.version), :headers => auth_header
|
get api_old_way_path(way_v3.way_id, way_v3.version), :headers => auth_header
|
||||||
assert_response :forbidden, "After redaction, node should be gone for moderator, when flag not passed."
|
assert_response :forbidden, "After redaction, node should be gone for moderator, when flag not passed."
|
||||||
get api_old_way_path(:id => way_v3.way_id, :version => way_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header
|
get api_old_way_path(way_v3.way_id, way_v3.version, :show_redactions => "true"), :headers => auth_header
|
||||||
assert_response :success, "After redaction, node should not be gone for moderator, when flag passed."
|
assert_response :success, "After redaction, node should not be gone for moderator, when flag passed."
|
||||||
|
|
||||||
# and when accessed via history
|
# and when accessed via history
|
||||||
get api_way_history_path(:id => way_v3.way_id), :headers => auth_header
|
get api_way_history_path(way), :headers => auth_header
|
||||||
assert_response :success, "Redaction shouldn't have stopped history working."
|
assert_response :success, "Redaction shouldn't have stopped history working."
|
||||||
assert_select "osm way[id='#{way_v3.way_id}'][version='#{way_v3.version}']", 0,
|
assert_select "osm way[id='#{way_v3.way_id}'][version='#{way_v3.version}']", 0,
|
||||||
"way #{way_v3.way_id} version #{way_v3.version} should not be present in the history for moderators when not passing flag."
|
"way #{way_v3.way_id} version #{way_v3.version} should not be present in the history for moderators when not passing flag."
|
||||||
get api_way_history_path(:id => way_v3.way_id), :params => { :show_redactions => "true" }, :headers => auth_header
|
get api_way_history_path(way, :show_redactions => "true"), :headers => auth_header
|
||||||
assert_response :success, "Redaction shouldn't have stopped history working."
|
assert_response :success, "Redaction shouldn't have stopped history working."
|
||||||
assert_select "osm way[id='#{way_v3.way_id}'][version='#{way_v3.version}']", 1,
|
assert_select "osm way[id='#{way_v3.way_id}'][version='#{way_v3.version}']", 1,
|
||||||
"way #{way_v3.way_id} version #{way_v3.version} should still be present in the history for moderators when passing flag."
|
"way #{way_v3.way_id} version #{way_v3.version} should still be present in the history for moderators when passing flag."
|
||||||
|
@ -235,11 +235,11 @@ module Api
|
||||||
auth_header = basic_authorization_header create(:user).email, "test"
|
auth_header = basic_authorization_header create(:user).email, "test"
|
||||||
|
|
||||||
# check can't see the redacted data
|
# check can't see the redacted data
|
||||||
get api_old_way_path(:id => way_v3.way_id, :version => way_v3.version), :headers => auth_header
|
get api_old_way_path(way_v3.way_id, way_v3.version), :headers => auth_header
|
||||||
assert_response :forbidden, "Redacted node shouldn't be visible via the version API."
|
assert_response :forbidden, "Redacted node shouldn't be visible via the version API."
|
||||||
|
|
||||||
# and when accessed via history
|
# and when accessed via history
|
||||||
get api_way_history_path(:id => way_v3.way_id), :headers => auth_header
|
get api_way_history_path(way), :headers => auth_header
|
||||||
assert_response :success, "Redaction shouldn't have stopped history working."
|
assert_response :success, "Redaction shouldn't have stopped history working."
|
||||||
assert_select "osm way[id='#{way_v3.way_id}'][version='#{way_v3.version}']", 0,
|
assert_select "osm way[id='#{way_v3.way_id}'][version='#{way_v3.version}']", 0,
|
||||||
"redacted way #{way_v3.way_id} version #{way_v3.version} shouldn't be present in the history."
|
"redacted way #{way_v3.way_id} version #{way_v3.version} shouldn't be present in the history."
|
||||||
|
@ -253,7 +253,7 @@ module Api
|
||||||
way_v1 = way.old_ways.find_by(:version => 1)
|
way_v1 = way.old_ways.find_by(:version => 1)
|
||||||
way_v1.redact!(create(:redaction))
|
way_v1.redact!(create(:redaction))
|
||||||
|
|
||||||
post way_version_redact_path(:id => way_v1.way_id, :version => way_v1.version)
|
post way_version_redact_path(way_v1.way_id, way_v1.version)
|
||||||
assert_response :unauthorized, "should need to be authenticated to unredact."
|
assert_response :unauthorized, "should need to be authenticated to unredact."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ module Api
|
||||||
|
|
||||||
auth_header = basic_authorization_header create(:user).email, "test"
|
auth_header = basic_authorization_header create(:user).email, "test"
|
||||||
|
|
||||||
post way_version_redact_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
|
post way_version_redact_path(way_v1.way_id, way_v1.version), :headers => auth_header
|
||||||
assert_response :forbidden, "should need to be moderator to unredact."
|
assert_response :forbidden, "should need to be moderator to unredact."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -282,16 +282,16 @@ module Api
|
||||||
|
|
||||||
auth_header = basic_authorization_header moderator_user.email, "test"
|
auth_header = basic_authorization_header moderator_user.email, "test"
|
||||||
|
|
||||||
post way_version_redact_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
|
post way_version_redact_path(way_v1.way_id, way_v1.version), :headers => auth_header
|
||||||
assert_response :success, "should be OK to unredact old version as moderator."
|
assert_response :success, "should be OK to unredact old version as moderator."
|
||||||
|
|
||||||
# check moderator can still see the unredacted data, without passing
|
# check moderator can still see the unredacted data, without passing
|
||||||
# the appropriate flag
|
# the appropriate flag
|
||||||
get api_old_way_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
|
get api_old_way_path(way_v1.way_id, way_v1.version), :headers => auth_header
|
||||||
assert_response :success, "After unredaction, node should not be gone for moderator."
|
assert_response :success, "After unredaction, node should not be gone for moderator."
|
||||||
|
|
||||||
# and when accessed via history
|
# and when accessed via history
|
||||||
get api_way_history_path(:id => way_v1.way_id), :headers => auth_header
|
get api_way_history_path(way), :headers => auth_header
|
||||||
assert_response :success, "Unredaction shouldn't have stopped history working."
|
assert_response :success, "Unredaction shouldn't have stopped history working."
|
||||||
assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 1,
|
assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 1,
|
||||||
"way #{way_v1.way_id} version #{way_v1.version} should still be present in the history for moderators."
|
"way #{way_v1.way_id} version #{way_v1.version} should still be present in the history for moderators."
|
||||||
|
@ -299,11 +299,11 @@ module Api
|
||||||
auth_header = basic_authorization_header create(:user).email, "test"
|
auth_header = basic_authorization_header create(:user).email, "test"
|
||||||
|
|
||||||
# check normal user can now see the unredacted data
|
# check normal user can now see the unredacted data
|
||||||
get api_old_way_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
|
get api_old_way_path(way_v1.way_id, way_v1.version), :headers => auth_header
|
||||||
assert_response :success, "After redaction, node should not be gone for moderator, when flag passed."
|
assert_response :success, "After redaction, node should not be gone for moderator, when flag passed."
|
||||||
|
|
||||||
# and when accessed via history
|
# and when accessed via history
|
||||||
get api_way_history_path(:id => way_v1.way_id), :headers => auth_header
|
get api_way_history_path(way), :headers => auth_header
|
||||||
assert_response :success, "Redaction shouldn't have stopped history working."
|
assert_response :success, "Redaction shouldn't have stopped history working."
|
||||||
assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 1,
|
assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 1,
|
||||||
"way #{way_v1.way_id} version #{way_v1.version} should still be present in the history for normal users."
|
"way #{way_v1.way_id} version #{way_v1.version} should still be present in the history for normal users."
|
||||||
|
@ -324,7 +324,7 @@ module Api
|
||||||
assert_not_nil current_way, "getting way #{way_id} returned nil"
|
assert_not_nil current_way, "getting way #{way_id} returned nil"
|
||||||
|
|
||||||
# get the "old" version of the way from the version method
|
# get the "old" version of the way from the version method
|
||||||
get api_old_way_path(:id => way_id, :version => current_way.version)
|
get api_old_way_path(way_id, current_way.version)
|
||||||
assert_response :success, "can't get old way #{way_id}, v#{current_way.version}"
|
assert_response :success, "can't get old way #{way_id}, v#{current_way.version}"
|
||||||
old_way = Way.from_xml(@response.body)
|
old_way = Way.from_xml(@response.body)
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ module Api
|
||||||
# look at all the versions of the way in the history and get each version from
|
# look at all the versions of the way in the history and get each version from
|
||||||
# the versions call. check that they're the same.
|
# the versions call. check that they're the same.
|
||||||
def check_history_equals_versions(way_id)
|
def check_history_equals_versions(way_id)
|
||||||
get api_way_history_path(:id => way_id)
|
get api_way_history_path(way_id)
|
||||||
assert_response :success, "can't get way #{way_id} from API"
|
assert_response :success, "can't get way #{way_id} from API"
|
||||||
history_doc = XML::Parser.string(@response.body).parse
|
history_doc = XML::Parser.string(@response.body).parse
|
||||||
assert_not_nil history_doc, "parsing way #{way_id} history failed"
|
assert_not_nil history_doc, "parsing way #{way_id} history failed"
|
||||||
|
@ -345,7 +345,7 @@ module Api
|
||||||
history_way = Way.from_xml_node(way_doc)
|
history_way = Way.from_xml_node(way_doc)
|
||||||
assert_not_nil history_way, "parsing way #{way_id} version failed"
|
assert_not_nil history_way, "parsing way #{way_id} version failed"
|
||||||
|
|
||||||
get api_old_way_path(:id => way_id, :version => history_way.version)
|
get api_old_way_path(way_id, history_way.version)
|
||||||
assert_response :success, "couldn't get way #{way_id}, v#{history_way.version}"
|
assert_response :success, "couldn't get way #{way_id}, v#{history_way.version}"
|
||||||
version_way = Way.from_xml(@response.body)
|
version_way = Way.from_xml(@response.body)
|
||||||
assert_not_nil version_way, "failed to parse #{way_id}, v#{history_way.version}"
|
assert_not_nil version_way, "failed to parse #{way_id}, v#{history_way.version}"
|
||||||
|
@ -368,11 +368,11 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
def do_redact_way(way, redaction, headers = {})
|
def do_redact_way(way, redaction, headers = {})
|
||||||
get api_old_way_path(:id => way.way_id, :version => way.version)
|
get api_old_way_path(way.way_id, way.version)
|
||||||
assert_response :success, "should be able to get version #{way.version} of way #{way.way_id}."
|
assert_response :success, "should be able to get version #{way.version} of way #{way.way_id}."
|
||||||
|
|
||||||
# now redact it
|
# now redact it
|
||||||
post way_version_redact_path(:id => way.way_id, :version => way.version), :params => { :redaction => redaction.id }, :headers => headers
|
post way_version_redact_path(way.way_id, way.version), :params => { :redaction => redaction.id }, :headers => headers
|
||||||
end
|
end
|
||||||
|
|
||||||
def propagate_tags(way, old_way)
|
def propagate_tags(way, old_way)
|
||||||
|
|
|
@ -82,7 +82,7 @@ module Api
|
||||||
assert_response :gone
|
assert_response :gone
|
||||||
|
|
||||||
# check chat a non-existent relation is not returned
|
# check chat a non-existent relation is not returned
|
||||||
get api_relation_path(:id => 0)
|
get api_relation_path(0)
|
||||||
assert_response :not_found
|
assert_response :not_found
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -178,11 +178,11 @@ module Api
|
||||||
assert_response :bad_request
|
assert_response :bad_request
|
||||||
|
|
||||||
# check error when no parameter value provided
|
# check error when no parameter value provided
|
||||||
get relations_path, :params => { :relations => "" }
|
get relations_path(:relations => "")
|
||||||
assert_response :bad_request
|
assert_response :bad_request
|
||||||
|
|
||||||
# test a working call
|
# 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_response :success
|
||||||
assert_select "osm" do
|
assert_select "osm" do
|
||||||
assert_select "relation", :count => 4
|
assert_select "relation", :count => 4
|
||||||
|
@ -193,7 +193,7 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
# test a working call with json format
|
# 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)
|
js = ActiveSupport::JSON.decode(@response.body)
|
||||||
assert_not_nil js
|
assert_not_nil js
|
||||||
|
@ -205,7 +205,7 @@ module Api
|
||||||
assert_equal 1, (js["elements"].count { |a| a["id"] == relation4.id && a["visible"].nil? })
|
assert_equal 1, (js["elements"].count { |a| a["id"] == relation4.id && a["visible"].nil? })
|
||||||
|
|
||||||
# check error when a non-existent relation is included
|
# 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
|
assert_response :not_found
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ module Api
|
||||||
assert checkrelation.visible,
|
assert checkrelation.visible,
|
||||||
"saved relation is not visible"
|
"saved relation is not visible"
|
||||||
# ok the relation is there but can we also retrieve it?
|
# ok the relation is there but can we also retrieve it?
|
||||||
get api_relation_path(:id => relationid)
|
get api_relation_path(relationid)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
###
|
###
|
||||||
|
@ -315,7 +315,7 @@ module Api
|
||||||
"saved relation is not visible"
|
"saved relation is not visible"
|
||||||
# ok the relation is there but can we also retrieve it?
|
# ok the relation is there but can we also retrieve it?
|
||||||
|
|
||||||
get api_relation_path(:id => relationid)
|
get api_relation_path(relationid)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
###
|
###
|
||||||
|
@ -343,7 +343,7 @@ module Api
|
||||||
"saved relation is not visible"
|
"saved relation is not visible"
|
||||||
# ok the relation is there but can we also retrieve it?
|
# ok the relation is there but can we also retrieve it?
|
||||||
|
|
||||||
get api_relation_path(:id => relationid)
|
get api_relation_path(relationid)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
###
|
###
|
||||||
|
@ -371,7 +371,7 @@ module Api
|
||||||
assert checkrelation.visible,
|
assert checkrelation.visible,
|
||||||
"saved relation is not visible"
|
"saved relation is not visible"
|
||||||
# ok the relation is there but can we also retrieve it?
|
# ok the relation is there but can we also retrieve it?
|
||||||
get api_relation_path(:id => relationid)
|
get api_relation_path(relationid)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ module Api
|
||||||
auth_header = basic_authorization_header user.email, "test"
|
auth_header = basic_authorization_header user.email, "test"
|
||||||
with_relation(relation.id) do |rel|
|
with_relation(relation.id) do |rel|
|
||||||
update_changeset(rel, changeset.id)
|
update_changeset(rel, changeset.id)
|
||||||
put api_relation_path(:id => other_relation.id), :params => rel.to_s, :headers => auth_header
|
put api_relation_path(other_relation), :params => rel.to_s, :headers => auth_header
|
||||||
assert_response :bad_request
|
assert_response :bad_request
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -560,7 +560,7 @@ module Api
|
||||||
assert_response :forbidden
|
assert_response :forbidden
|
||||||
|
|
||||||
# this won't work since the relation never existed
|
# this won't work since the relation never existed
|
||||||
delete api_relation_path(:id => 0), :headers => auth_header
|
delete api_relation_path(0), :headers => auth_header
|
||||||
assert_response :forbidden
|
assert_response :forbidden
|
||||||
|
|
||||||
## now set auth for the public user
|
## now set auth for the public user
|
||||||
|
@ -632,7 +632,7 @@ module Api
|
||||||
"should be able to delete a relation used in an old relation (#{@response.body})"
|
"should be able to delete a relation used in an old relation (#{@response.body})"
|
||||||
|
|
||||||
# this won't work since the relation never existed
|
# this won't work since the relation never existed
|
||||||
delete api_relation_path(:id => 0), :headers => auth_header
|
delete api_relation_path(0), :headers => auth_header
|
||||||
assert_response :not_found
|
assert_response :not_found
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -695,7 +695,7 @@ module Api
|
||||||
update_changeset(relation_xml, changeset_id)
|
update_changeset(relation_xml, changeset_id)
|
||||||
|
|
||||||
# upload the change
|
# upload the change
|
||||||
put api_relation_path(:id => relation.id), :params => relation_xml.to_s, :headers => auth_header
|
put api_relation_path(relation), :params => relation_xml.to_s, :headers => auth_header
|
||||||
assert_response :success, "can't update relation for add #{element.class}/bbox test: #{@response.body}"
|
assert_response :success, "can't update relation for add #{element.class}/bbox test: #{@response.body}"
|
||||||
|
|
||||||
# get it back and check the ordering
|
# get it back and check the ordering
|
||||||
|
@ -762,7 +762,7 @@ module Api
|
||||||
relation_id = @response.body.to_i
|
relation_id = @response.body.to_i
|
||||||
|
|
||||||
# get it back and check the ordering
|
# get it back and check the ordering
|
||||||
get api_relation_path(:id => relation_id)
|
get api_relation_path(relation_id)
|
||||||
assert_response :success, "can't read back the relation: #{@response.body}"
|
assert_response :success, "can't read back the relation: #{@response.body}"
|
||||||
check_ordering(doc, @response.body)
|
check_ordering(doc, @response.body)
|
||||||
|
|
||||||
|
@ -777,18 +777,18 @@ module Api
|
||||||
doc.find("//osm/relation").first["version"] = 1.to_s
|
doc.find("//osm/relation").first["version"] = 1.to_s
|
||||||
|
|
||||||
# upload the next version of the relation
|
# upload the next version of the relation
|
||||||
put api_relation_path(:id => relation_id), :params => doc.to_s, :headers => auth_header
|
put api_relation_path(relation_id), :params => doc.to_s, :headers => auth_header
|
||||||
assert_response :success, "can't update relation: #{@response.body}"
|
assert_response :success, "can't update relation: #{@response.body}"
|
||||||
assert_equal 2, @response.body.to_i
|
assert_equal 2, @response.body.to_i
|
||||||
|
|
||||||
# get it back again and check the ordering again
|
# get it back again and check the ordering again
|
||||||
get api_relation_path(:id => relation_id)
|
get api_relation_path(relation_id)
|
||||||
assert_response :success, "can't read back the relation: #{@response.body}"
|
assert_response :success, "can't read back the relation: #{@response.body}"
|
||||||
check_ordering(doc, @response.body)
|
check_ordering(doc, @response.body)
|
||||||
|
|
||||||
# check the ordering in the history tables:
|
# check the ordering in the history tables:
|
||||||
with_controller(OldRelationsController.new) do
|
with_controller(OldRelationsController.new) do
|
||||||
get api_old_relation_path(:id => relation_id, :version => 2)
|
get api_old_relation_path(relation_id, 2)
|
||||||
assert_response :success, "can't read back version 2 of the relation #{relation_id}"
|
assert_response :success, "can't read back version 2 of the relation #{relation_id}"
|
||||||
check_ordering(doc, @response.body)
|
check_ordering(doc, @response.body)
|
||||||
end
|
end
|
||||||
|
@ -829,7 +829,7 @@ module Api
|
||||||
relation_id = @response.body.to_i
|
relation_id = @response.body.to_i
|
||||||
|
|
||||||
# get it back and check the ordering
|
# get it back and check the ordering
|
||||||
get api_relation_path(:id => relation_id)
|
get api_relation_path(relation_id)
|
||||||
assert_response :success, "can't read back the relation: #{relation_id}"
|
assert_response :success, "can't read back the relation: #{relation_id}"
|
||||||
check_ordering(doc, @response.body)
|
check_ordering(doc, @response.body)
|
||||||
end
|
end
|
||||||
|
@ -862,13 +862,13 @@ module Api
|
||||||
relation_id = @response.body.to_i
|
relation_id = @response.body.to_i
|
||||||
|
|
||||||
# check the ordering in the current tables:
|
# check the ordering in the current tables:
|
||||||
get api_relation_path(:id => relation_id)
|
get api_relation_path(relation_id)
|
||||||
assert_response :success, "can't read back the relation: #{@response.body}"
|
assert_response :success, "can't read back the relation: #{@response.body}"
|
||||||
check_ordering(doc, @response.body)
|
check_ordering(doc, @response.body)
|
||||||
|
|
||||||
# check the ordering in the history tables:
|
# check the ordering in the history tables:
|
||||||
with_controller(OldRelationsController.new) do
|
with_controller(OldRelationsController.new) do
|
||||||
get api_old_relation_path(:id => relation_id, :version => 1)
|
get api_old_relation_path(relation_id, 1)
|
||||||
assert_response :success, "can't read back version 1 of the relation: #{@response.body}"
|
assert_response :success, "can't read back version 1 of the relation: #{@response.body}"
|
||||||
check_ordering(doc, @response.body)
|
check_ordering(doc, @response.body)
|
||||||
end
|
end
|
||||||
|
@ -1106,10 +1106,10 @@ module Api
|
||||||
# doc is returned.
|
# doc is returned.
|
||||||
def with_relation(id, ver = nil)
|
def with_relation(id, ver = nil)
|
||||||
if ver.nil?
|
if ver.nil?
|
||||||
get api_relation_path(:id => id)
|
get api_relation_path(id)
|
||||||
else
|
else
|
||||||
with_controller(OldRelationsController.new) do
|
with_controller(OldRelationsController.new) do
|
||||||
get api_old_relation_path(:id => id, :version => ver)
|
get api_old_relation_path(id, ver)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
@ -1122,12 +1122,12 @@ module Api
|
||||||
# the parsed XML doc is returned.
|
# the parsed XML doc is returned.
|
||||||
def with_update(rel, headers)
|
def with_update(rel, headers)
|
||||||
rel_id = rel.find("//osm/relation").first["id"].to_i
|
rel_id = rel.find("//osm/relation").first["id"].to_i
|
||||||
put api_relation_path(:id => rel_id), :params => rel.to_s, :headers => headers
|
put api_relation_path(rel_id), :params => rel.to_s, :headers => headers
|
||||||
assert_response :success, "can't update relation: #{@response.body}"
|
assert_response :success, "can't update relation: #{@response.body}"
|
||||||
version = @response.body.to_i
|
version = @response.body.to_i
|
||||||
|
|
||||||
# now get the new version
|
# now get the new version
|
||||||
get api_relation_path(:id => rel_id)
|
get api_relation_path(rel_id)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
new_rel = xml_parse(@response.body)
|
new_rel = xml_parse(@response.body)
|
||||||
|
|
||||||
|
@ -1159,7 +1159,7 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
# now get the new version
|
# now get the new version
|
||||||
get api_relation_path(:id => rel_id)
|
get api_relation_path(rel_id)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
new_rel = xml_parse(@response.body)
|
new_rel = xml_parse(@response.body)
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ module Api
|
||||||
assert_response :gone
|
assert_response :gone
|
||||||
|
|
||||||
# check chat a non-existent way is not returned
|
# check chat a non-existent way is not returned
|
||||||
get api_way_path(:id => 0)
|
get api_way_path(0)
|
||||||
assert_response :not_found
|
assert_response :not_found
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -102,11 +102,11 @@ module Api
|
||||||
assert_response :bad_request
|
assert_response :bad_request
|
||||||
|
|
||||||
# check error when no parameter value provided
|
# check error when no parameter value provided
|
||||||
get ways_path, :params => { :ways => "" }
|
get ways_path(:ways => "")
|
||||||
assert_response :bad_request
|
assert_response :bad_request
|
||||||
|
|
||||||
# test a working call
|
# 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_response :success
|
||||||
assert_select "osm" do
|
assert_select "osm" do
|
||||||
assert_select "way", :count => 4
|
assert_select "way", :count => 4
|
||||||
|
@ -117,7 +117,7 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
# test a working call with json format
|
# 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)
|
js = ActiveSupport::JSON.decode(@response.body)
|
||||||
assert_not_nil js
|
assert_not_nil js
|
||||||
|
@ -129,7 +129,7 @@ module Api
|
||||||
assert_equal 1, (js["elements"].count { |a| a["id"] == way4.id && a["visible"].nil? })
|
assert_equal 1, (js["elements"].count { |a| a["id"] == way4.id && a["visible"].nil? })
|
||||||
|
|
||||||
# check error when a non-existent way is included
|
# 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
|
assert_response :not_found
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ module Api
|
||||||
"shouldn't be able to delete a way used in a relation (#{@response.body}), when done by a private user"
|
"shouldn't be able to delete a way used in a relation (#{@response.body}), when done by a private user"
|
||||||
|
|
||||||
# this won't work since the way never existed
|
# this won't work since the way never existed
|
||||||
delete api_way_path(:id => 0), :headers => auth_header
|
delete api_way_path(0), :headers => auth_header
|
||||||
assert_response :forbidden
|
assert_response :forbidden
|
||||||
|
|
||||||
### Now check with a public user
|
### Now check with a public user
|
||||||
|
@ -394,7 +394,7 @@ module Api
|
||||||
assert_equal "Precondition failed: Way #{used_way.id} is still used by relations #{relation.id}.", @response.body
|
assert_equal "Precondition failed: Way #{used_way.id} is still used by relations #{relation.id}.", @response.body
|
||||||
|
|
||||||
# this won't work since the way never existed
|
# this won't work since the way never existed
|
||||||
delete api_way_path(:id => 0), :params => xml.to_s, :headers => auth_header
|
delete api_way_path(0), :params => xml.to_s, :headers => auth_header
|
||||||
assert_response :not_found
|
assert_response :not_found
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue