private
def lookup_old_element
- @old_element = OldNode.find([params[:id], params[:version]])
+ @old_element = OldNode.find([params[:node_id], params[:version]])
end
def lookup_old_element_versions
private
def lookup_old_element
- @old_element = OldRelation.find([params[:id], params[:version]])
+ @old_element = OldRelation.find([params[:relation_id], params[:version]])
end
def lookup_old_element_versions
private
def lookup_old_element
- @old_element = OldWay.find([params[:id], params[:version]])
+ @old_element = OldWay.find([params[:way_id], params[:version]])
end
def lookup_old_element_versions
<%= link_to t("browse.view_details"), :controller => @type.pluralize, :action => :show %>
<% if !@feature.redacted? %>
·
- <%= link_to t("browse.download_xml"), :controller => "api/old_#{@type.pluralize}", :action => :show %>
+ <%= link_to t("browse.download_xml"), send(:"api_#{@type}_version_path", *@feature.id) %>
<% elsif current_user&.moderator? %>
·
<% if !params[:show_redactions] %>
post "changeset/comment/:id/hide" => "changeset_comments#destroy", :as => :changeset_comment_hide, :id => /\d+/
post "changeset/comment/:id/unhide" => "changeset_comments#restore", :as => :changeset_comment_unhide, :id => /\d+/
- post "node/:id/:version/redact" => "old_nodes#redact", :as => :node_version_redact, :version => /\d+/, :id => /\d+/
- get "node/:id/:version" => "old_nodes#show", :as => :api_old_node, :id => /\d+/, :version => /\d+/
+ post "node/:node_id/:version/redact" => "old_nodes#redact", :as => :node_version_redact, :version => /\d+/, :node_id => /\d+/
- post "way/:id/:version/redact" => "old_ways#redact", :as => :way_version_redact, :version => /\d+/, :id => /\d+/
- get "way/:id/:version" => "old_ways#show", :as => :api_old_way, :id => /\d+/, :version => /\d+/
+ post "way/:way_id/:version/redact" => "old_ways#redact", :as => :way_version_redact, :version => /\d+/, :id => /\d+/
- post "relation/:id/:version/redact" => "old_relations#redact", :as => :relation_version_redact, :version => /\d+/, :id => /\d+/
- get "relation/:id/:version" => "old_relations#show", :as => :api_old_relation, :id => /\d+/, :version => /\d+/
+ post "relation/:relation_id/:version/redact" => "old_relations#redact", :as => :relation_version_redact, :version => /\d+/, :id => /\d+/
end
namespace :api, :path => "api/0.6" do
resources :relations, :only => :index
end
resources :versions, :path => "history", :controller => :old_nodes, :only => :index
+ resources :versions, :path => "", :version => /\d+/, :param => :version, :controller => :old_nodes, :only => :show
end
put "node/create" => "nodes#create", :as => nil
resources :relations, :only => :index
end
resources :versions, :path => "history", :controller => :old_ways, :only => :index
+ resources :versions, :path => "", :version => /\d+/, :param => :version, :controller => :old_ways, :only => :show
end
put "way/create" => "ways#create", :as => nil
resources :relations, :only => :index
end
resources :versions, :path => "history", :controller => :old_relations, :only => :index
+ resources :versions, :path => "", :version => /\d+/, :param => :version, :controller => :old_relations, :only => :show
end
put "relation/create" => "relations#create", :as => nil
)
assert_routing(
{ :path => "/api/0.6/node/1/2", :method => :get },
- { :controller => "api/old_nodes", :action => "show", :id => "1", :version => "2" }
+ { :controller => "api/old_nodes", :action => "show", :node_id => "1", :version => "2" }
)
assert_routing(
{ :path => "/api/0.6/node/1/2.json", :method => :get },
- { :controller => "api/old_nodes", :action => "show", :id => "1", :version => "2", :format => "json" }
+ { :controller => "api/old_nodes", :action => "show", :node_id => "1", :version => "2", :format => "json" }
)
assert_routing(
{ :path => "/api/0.6/node/1/2/redact", :method => :post },
- { :controller => "api/old_nodes", :action => "redact", :id => "1", :version => "2" }
+ { :controller => "api/old_nodes", :action => "redact", :node_id => "1", :version => "2" }
)
end
#
##
# FIXME: Move this test to being an integration test since it spans multiple controllers
- def test_version
+ def test_show
private_user = create(:user, :data_public => false)
private_node = create(:node, :with_history, :version => 4, :lat => 0, :lon => 0, :changeset => create(:changeset, :user => private_user))
user = create(:user)
# check all the versions
versions.each_key do |key|
- get api_old_node_path(nodeid, key.to_i)
+ get api_node_version_path(nodeid, key.to_i)
assert_response :success,
"couldn't get version #{key.to_i} of node #{nodeid}"
end
end
- def test_not_found_version
+ def test_show_not_found
check_not_found_id_version(70000, 312344)
check_not_found_id_version(-1, -13)
check_not_found_id_version(create(:node).id, 24354)
check_not_found_id_version(24356, create(:node).version)
end
+ ##
+ # test that redacted nodes aren't visible, regardless of
+ # authorisation except as moderator...
+ def test_show_redacted
+ node = create(:node, :with_history, :version => 2)
+ node_v1 = node.old_nodes.find_by(:version => 1)
+ node_v1.redact!(create(:redaction))
+
+ get api_node_version_path(node_v1.node_id, 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 = bearer_authorization_header
+ get api_node_version_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."
+ end
+
##
# Test that getting the current version is identical to picking
# that version with the version URI call.
assert_response :success, "should be OK to redact old version as moderator with write_redactions scope."
end
- ##
- # test that redacted nodes aren't visible, regardless of
- # authorisation except as moderator...
- def test_version_redacted
- node = create(:node, :with_history, :version => 2)
- node_v1 = node.old_nodes.find_by(:version => 1)
- node_v1.redact!(create(:redaction))
-
- 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."
-
- # not even to a logged-in user
- auth_header = bearer_authorization_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."
- end
-
##
# test the redaction of an old version of a node, while being
# authorised as a moderator.
# check moderator can still see the redacted data, when passing
# the appropriate flag
- get api_old_node_path(node_v3.node_id, node_v3.version), :headers => auth_header
+ get api_node_version_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."
- get api_old_node_path(node_v3.node_id, node_v3.version, :show_redactions => "true"), :headers => auth_header
+ get api_node_version_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."
# and when accessed via history
auth_header = bearer_authorization_header
# check can't see the redacted data
- get api_old_node_path(node_v3.node_id, node_v3.version), :headers => auth_header
+ get api_node_version_path(node_v3.node_id, 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 api_old_node_path(node_v1.node_id, node_v1.version), :headers => auth_header
+ get api_node_version_path(node_v1.node_id, 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 = bearer_authorization_header
# check normal user can now see the redacted data
- get api_old_node_path(node_v1.node_id, node_v1.version), :headers => auth_header
+ get api_node_version_path(node_v1.node_id, 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 api_old_node_path(node.node_id, node.version), :headers => headers
+ get api_node_version_path(node.node_id, 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 api_old_node_path(node_id, current_node.version)
+ get api_node_version_path(node_id, 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 api_old_node_path(id, version)
+ get api_node_version_path(id, version)
assert_response :not_found
rescue ActionController::UrlGenerationError => e
assert_match(/No route matches/, e.to_s)
)
assert_routing(
{ :path => "/api/0.6/relation/1/2", :method => :get },
- { :controller => "api/old_relations", :action => "show", :id => "1", :version => "2" }
+ { :controller => "api/old_relations", :action => "show", :relation_id => "1", :version => "2" }
)
assert_routing(
{ :path => "/api/0.6/relation/1/2.json", :method => :get },
- { :controller => "api/old_relations", :action => "show", :id => "1", :version => "2", :format => "json" }
+ { :controller => "api/old_relations", :action => "show", :relation_id => "1", :version => "2", :format => "json" }
)
assert_routing(
{ :path => "/api/0.6/relation/1/2/redact", :method => :post },
- { :controller => "api/old_relations", :action => "redact", :id => "1", :version => "2" }
+ { :controller => "api/old_relations", :action => "redact", :relation_id => "1", :version => "2" }
)
end
"redacted relation #{relation_v1.relation_id} version #{relation_v1.version} shouldn't be present in the history, even when logged in."
end
+ def test_show
+ relation = create(:relation, :with_history, :version => 2)
+ create(:old_relation_tag, :old_relation => relation.old_relations[0], :k => "k1", :v => "v1")
+ create(:old_relation_tag, :old_relation => relation.old_relations[1], :k => "k2", :v => "v2")
+
+ get api_relation_version_path(relation, 1)
+
+ assert_response :success
+ assert_dom "osm:root", 1 do
+ assert_dom "> relation", 1 do
+ assert_dom "> @id", relation.id.to_s
+ assert_dom "> @version", "1"
+ assert_dom "> tag", 1 do
+ assert_dom "> @k", "k1"
+ assert_dom "> @v", "v1"
+ end
+ end
+ end
+
+ get api_relation_version_path(relation, 2)
+
+ assert_response :success
+ assert_dom "osm:root", 1 do
+ assert_dom "> relation", 1 do
+ assert_dom "> @id", relation.id.to_s
+ assert_dom "> @version", "2"
+ assert_dom "> tag", 1 do
+ assert_dom "> @k", "k2"
+ assert_dom "> @v", "v2"
+ end
+ end
+ end
+ end
+
+ ##
+ # test that redacted relations aren't visible, regardless of
+ # authorisation except as moderator...
+ def test_show_redacted
+ relation = create(:relation, :with_history, :version => 2)
+ relation_v1 = relation.old_relations.find_by(:version => 1)
+ relation_v1.redact!(create(:redaction))
+
+ get api_relation_version_path(relation_v1.relation_id, 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 = bearer_authorization_header
+ get api_relation_version_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."
+ end
+
##
# test the redaction of an old version of a relation, while not being
# authorised.
assert_response :success, "should be OK to redact old version as moderator with write_redactions scope."
end
- ##
- # test that redacted relations aren't visible, regardless of
- # authorisation except as moderator...
- def test_version_redacted
- relation = create(:relation, :with_history, :version => 2)
- relation_v1 = relation.old_relations.find_by(:version => 1)
- relation_v1.redact!(create(:redaction))
-
- 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."
-
- # not even to a logged-in user
- auth_header = bearer_authorization_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."
- end
-
##
# test the redaction of an old version of a relation, while being
# authorised as a moderator.
# check moderator can still see the redacted data, when passing
# the appropriate flag
- get api_old_relation_path(relation_v3.relation_id, relation_v3.version), :headers => auth_header
+ get api_relation_version_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."
- get api_old_relation_path(relation_v3.relation_id, relation_v3.version, :show_redactions => "true"), :headers => auth_header
+ get api_relation_version_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."
# and when accessed via history
auth_header = bearer_authorization_header
# check can't see the redacted data
- get api_old_relation_path(relation_v3.relation_id, relation_v3.version), :headers => auth_header
+ get api_relation_version_path(relation_v3.relation_id, 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 api_old_relation_path(relation_v1.relation_id, relation_v1.version), :headers => auth_header
+ get api_relation_version_path(relation_v1.relation_id, 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 = bearer_authorization_header
# check normal user can now see the redacted data
- get api_old_relation_path(relation_v1.relation_id, relation_v1.version), :headers => auth_header
+ get api_relation_version_path(relation_v1.relation_id, 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 api_old_relation_path(relation.relation_id, relation.version)
+ get api_relation_version_path(relation.relation_id, relation.version)
assert_response :success, "should be able to get version #{relation.version} of relation #{relation.relation_id}."
# now redact it
)
assert_routing(
{ :path => "/api/0.6/way/1/2", :method => :get },
- { :controller => "api/old_ways", :action => "show", :id => "1", :version => "2" }
+ { :controller => "api/old_ways", :action => "show", :way_id => "1", :version => "2" }
)
assert_routing(
{ :path => "/api/0.6/way/1/2.json", :method => :get },
- { :controller => "api/old_ways", :action => "show", :id => "1", :version => "2", :format => "json" }
+ { :controller => "api/old_ways", :action => "show", :way_id => "1", :version => "2", :format => "json" }
)
assert_routing(
{ :path => "/api/0.6/way/1/2/redact", :method => :post },
- { :controller => "api/old_ways", :action => "redact", :id => "1", :version => "2" }
+ { :controller => "api/old_ways", :action => "redact", :way_id => "1", :version => "2" }
)
end
##
# check that we can retrieve versions of a way
- def test_version
+ def test_show
way = create(:way, :with_history)
used_way = create(:way, :with_history)
create(:relation_member, :member => used_way)
check_current_version(way_with_versions.id)
end
+ ##
+ # test that redacted ways aren't visible, regardless of
+ # authorisation except as moderator...
+ def test_show_redacted
+ way = create(:way, :with_history, :version => 2)
+ way_v1 = way.old_ways.find_by(:version => 1)
+ way_v1.redact!(create(:redaction))
+
+ get api_way_version_path(way_v1.way_id, 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 = bearer_authorization_header
+ get api_way_version_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."
+ end
+
##
# check that returned history is the same as getting all
# versions of a way from the api.
assert_response :success, "should be OK to redact old version as moderator with write_redactions scope."
end
- ##
- # test that redacted ways aren't visible, regardless of
- # authorisation except as moderator...
- def test_version_redacted
- way = create(:way, :with_history, :version => 2)
- way_v1 = way.old_ways.find_by(:version => 1)
- way_v1.redact!(create(:redaction))
-
- 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."
-
- # not even to a logged-in user
- auth_header = bearer_authorization_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."
- end
-
##
# test the redaction of an old version of a way, while being
# authorised as a moderator.
# check moderator can still see the redacted data, when passing
# the appropriate flag
- get api_old_way_path(way_v3.way_id, way_v3.version), :headers => auth_header
+ get api_way_version_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."
- get api_old_way_path(way_v3.way_id, way_v3.version, :show_redactions => "true"), :headers => auth_header
+ get api_way_version_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."
# and when accessed via history
auth_header = bearer_authorization_header
# check can't see the redacted data
- get api_old_way_path(way_v3.way_id, way_v3.version), :headers => auth_header
+ get api_way_version_path(way_v3.way_id, 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 api_old_way_path(way_v1.way_id, way_v1.version), :headers => auth_header
+ get api_way_version_path(way_v1.way_id, 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 = bearer_authorization_header
# check normal user can now see the unredacted data
- get api_old_way_path(way_v1.way_id, way_v1.version), :headers => auth_header
+ get api_way_version_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."
# 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 api_old_way_path(way_id, current_way.version)
+ get api_way_version_path(way_id, 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 api_old_way_path(way_id, history_way.version)
+ get api_way_version_path(way_id, 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 api_old_way_path(way.way_id, way.version)
+ get api_way_version_path(way.way_id, 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 api_old_relation_path(relation_id, 2)
+ get api_relation_version_path(relation_id, 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 api_old_relation_path(relation_id, 1)
+ get api_relation_version_path(relation_id, 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)
else
with_controller(OldRelationsController.new) do
- get api_old_relation_path(id, ver)
+ get api_relation_version_path(id, 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='#{api_old_node_path node, 1}']", :count => 1
+ assert_select ".secondary-actions a[href='#{api_node_version_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='#{api_old_node_path node, 1}']", :count => 1
+ assert_select ".secondary-actions a[href='#{api_node_version_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='#{api_old_node_path node, 2}']", :count => 1
+ assert_select ".secondary-actions a[href='#{api_node_version_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='#{api_old_node_path node, 1}']", :count => 0
+ assert_select ".secondary-actions a[href='#{api_node_version_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='#{api_old_node_path node, 1}']", :count => 0
+ assert_select ".secondary-actions a[href='#{api_node_version_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='#{api_old_node_path node, 1}']", :count => 0
+ assert_select ".secondary-actions a[href='#{api_node_version_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='#{api_old_relation_path relation, 1}']", :count => 1
+ assert_select ".secondary-actions a[href='#{api_relation_version_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='#{api_old_relation_path relation, 1}']", :count => 1
+ assert_select ".secondary-actions a[href='#{api_relation_version_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='#{api_old_relation_path relation, 2}']", :count => 1
+ assert_select ".secondary-actions a[href='#{api_relation_version_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='#{api_old_relation_path relation, 1}']", :count => 0
+ assert_select ".secondary-actions a[href='#{api_relation_version_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='#{api_old_relation_path relation, 1}']", :count => 0
+ assert_select ".secondary-actions a[href='#{api_relation_version_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='#{api_old_relation_path relation, 1}']", :count => 0
+ assert_select ".secondary-actions a[href='#{api_relation_version_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='#{api_old_way_path way, 1}']", :count => 1
+ assert_select ".secondary-actions a[href='#{api_way_version_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='#{api_old_way_path way, 1}']", :count => 1
+ assert_select ".secondary-actions a[href='#{api_way_version_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='#{api_old_way_path way, 2}']", :count => 1
+ assert_select ".secondary-actions a[href='#{api_way_version_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='#{api_old_way_path way, 1}']", :count => 0
+ assert_select ".secondary-actions a[href='#{api_way_version_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='#{api_old_way_path way, 1}']", :count => 0
+ assert_select ".secondary-actions a[href='#{api_way_version_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='#{api_old_way_path way, 1}']", :count => 0
+ assert_select ".secondary-actions a[href='#{api_way_version_path way, 1}']", :count => 0
end
test "don't reveal redacted versions to anonymous users" do