From: Anton Khorev Date: Sun, 3 Mar 2024 10:13:26 +0000 (+0300) Subject: Rename api element version path helper X-Git-Tag: live~734^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/ad96da4518adbe378eedb072ef5834a992ea6576 Rename api element version path helper --- diff --git a/config/routes.rb b/config/routes.rb index eee349855..fad5f5a4b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -35,7 +35,7 @@ OpenStreetMap::Application.routes.draw do get "node/:id/relations" => "api/relations#relations_for_node", :as => :node_relations, :id => /\d+/ get "node/:id/history" => "api/old_nodes#history", :as => :api_node_history, :id => /\d+/ post "node/:id/:version/redact" => "api/old_nodes#redact", :as => :node_version_redact, :version => /\d+/, :id => /\d+/ - get "node/:id/:version" => "api/old_nodes#show", :as => :node_version, :id => /\d+/, :version => /\d+/ + get "node/:id/:version" => "api/old_nodes#show", :as => :api_old_node, :id => /\d+/, :version => /\d+/ get "node/:id" => "api/nodes#show", :as => :api_node, :id => /\d+/ put "node/:id" => "api/nodes#update", :id => /\d+/ delete "node/:id" => "api/nodes#delete", :id => /\d+/ @@ -46,7 +46,7 @@ OpenStreetMap::Application.routes.draw do get "way/:id/full" => "api/ways#full", :as => :way_full, :id => /\d+/ get "way/:id/relations" => "api/relations#relations_for_way", :as => :way_relations, :id => /\d+/ post "way/:id/:version/redact" => "api/old_ways#redact", :as => :way_version_redact, :version => /\d+/, :id => /\d+/ - get "way/:id/:version" => "api/old_ways#show", :as => :way_version, :id => /\d+/, :version => /\d+/ + get "way/:id/:version" => "api/old_ways#show", :as => :api_old_way, :id => /\d+/, :version => /\d+/ get "way/:id" => "api/ways#show", :as => :api_way, :id => /\d+/ put "way/:id" => "api/ways#update", :id => /\d+/ delete "way/:id" => "api/ways#delete", :id => /\d+/ @@ -57,7 +57,7 @@ OpenStreetMap::Application.routes.draw do get "relation/:id/history" => "api/old_relations#history", :as => :api_relation_history, :id => /\d+/ get "relation/:id/full" => "api/relations#full", :as => :relation_full, :id => /\d+/ post "relation/:id/:version/redact" => "api/old_relations#redact", :as => :relation_version_redact, :version => /\d+/, :id => /\d+/ - get "relation/:id/:version" => "api/old_relations#show", :as => :relation_version, :id => /\d+/, :version => /\d+/ + get "relation/:id/:version" => "api/old_relations#show", :as => :api_old_relation, :id => /\d+/, :version => /\d+/ get "relation/:id" => "api/relations#show", :as => :api_relation, :id => /\d+/ put "relation/:id" => "api/relations#update", :id => /\d+/ delete "relation/:id" => "api/relations#delete", :id => /\d+/ diff --git a/test/controllers/api/old_nodes_controller_test.rb b/test/controllers/api/old_nodes_controller_test.rb index da5466748..a982705ed 100644 --- a/test/controllers/api/old_nodes_controller_test.rb +++ b/test/controllers/api/old_nodes_controller_test.rb @@ -142,7 +142,7 @@ module Api # check all the versions versions.each_key do |key| - get node_version_path(:id => nodeid, :version => key.to_i) + get api_old_node_path(:id => nodeid, :version => key.to_i) assert_response :success, "couldn't get version #{key.to_i} of node #{nodeid}" @@ -283,12 +283,12 @@ module Api node_v1 = node.old_nodes.find_by(:version => 1) node_v1.redact!(create(:redaction)) - get node_version_path(:id => node_v1.node_id, :version => node_v1.version) + get api_old_node_path(:id => node_v1.node_id, :version => node_v1.version) assert_response :forbidden, "Redacted node shouldn't be visible via the version API." # not even to a logged-in user auth_header = basic_authorization_header create(:user).email, "test" - get node_version_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header + get api_old_node_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header assert_response :forbidden, "Redacted node shouldn't be visible via the version API, even when logged in." end @@ -325,9 +325,9 @@ module Api # check moderator can still see the redacted data, when passing # the appropriate flag - get node_version_path(:id => node_v3.node_id, :version => node_v3.version), :headers => auth_header + get api_old_node_path(:id => node_v3.node_id, :version => node_v3.version), :headers => auth_header assert_response :forbidden, "After redaction, node should be gone for moderator, when flag not passed." - get node_version_path(:id => node_v3.node_id, :version => node_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header + get api_old_node_path(:id => node_v3.node_id, :version => node_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header assert_response :success, "After redaction, node should not be gone for moderator, when flag passed." # and when accessed via history @@ -355,7 +355,7 @@ module Api auth_header = basic_authorization_header create(:user).email, "test" # check can't see the redacted data - get node_version_path(:id => node_v3.node_id, :version => node_v3.version), :headers => auth_header + get api_old_node_path(:id => node_v3.node_id, :version => node_v3.version), :headers => auth_header assert_response :forbidden, "Redacted node shouldn't be visible via the version API." # and when accessed via history @@ -408,7 +408,7 @@ module Api # check moderator can now see the redacted data, when not # passing the aspecial flag - get node_version_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header + get api_old_node_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header assert_response :success, "After unredaction, node should not be gone for moderator." # and when accessed via history @@ -420,7 +420,7 @@ module Api auth_header = basic_authorization_header create(:user).email, "test" # check normal user can now see the redacted data - get node_version_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header + get api_old_node_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header assert_response :success, "After unredaction, node should be visible to normal users." # and when accessed via history @@ -446,7 +446,7 @@ module Api end def do_redact_node(node, redaction, headers = {}) - get node_version_path(:id => node.node_id, :version => node.version), :headers => headers + get api_old_node_path(:id => node.node_id, :version => node.version), :headers => headers assert_response :success, "should be able to get version #{node.version} of node #{node.node_id}." # now redact it @@ -463,7 +463,7 @@ module Api assert_not_nil current_node, "getting node #{node_id} returned nil" # get the "old" version of the node from the old_node interface - get node_version_path(:id => node_id, :version => current_node.version) + get api_old_node_path(:id => node_id, :version => current_node.version) assert_response :success, "cant get old node #{node_id}, v#{current_node.version}" old_node = Node.from_xml(@response.body) @@ -472,7 +472,7 @@ module Api end def check_not_found_id_version(id, version) - get node_version_path(:id => id, :version => version) + get api_old_node_path(:id => id, :version => version) assert_response :not_found rescue ActionController::UrlGenerationError => e assert_match(/No route matches/, e.to_s) diff --git a/test/controllers/api/old_relations_controller_test.rb b/test/controllers/api/old_relations_controller_test.rb index 79c1b515b..400271123 100644 --- a/test/controllers/api/old_relations_controller_test.rb +++ b/test/controllers/api/old_relations_controller_test.rb @@ -122,12 +122,12 @@ module Api relation_v1 = relation.old_relations.find_by(:version => 1) relation_v1.redact!(create(:redaction)) - get relation_version_path(:id => relation_v1.relation_id, :version => relation_v1.version) + get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version) assert_response :forbidden, "Redacted relation shouldn't be visible via the version API." # not even to a logged-in user auth_header = basic_authorization_header create(:user).email, "test" - get relation_version_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header + get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header assert_response :forbidden, "Redacted relation shouldn't be visible via the version API, even when logged in." end @@ -145,7 +145,7 @@ module Api # not even to a logged-in user auth_header = basic_authorization_header create(:user).email, "test" - get relation_version_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header + get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header get api_relation_history_path(:id => relation_v1.relation_id), :headers => auth_header assert_response :success, "Redaction shouldn't have stopped history working." assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 0, @@ -166,9 +166,9 @@ module Api # check moderator can still see the redacted data, when passing # the appropriate flag - get relation_version_path(:id => relation_v3.relation_id, :version => relation_v3.version), :headers => auth_header + get api_old_relation_path(:id => relation_v3.relation_id, :version => relation_v3.version), :headers => auth_header assert_response :forbidden, "After redaction, relation should be gone for moderator, when flag not passed." - get relation_version_path(:id => relation_v3.relation_id, :version => relation_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header + get api_old_relation_path(:id => relation_v3.relation_id, :version => relation_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header assert_response :success, "After redaction, relation should not be gone for moderator, when flag passed." # and when accessed via history @@ -197,7 +197,7 @@ module Api auth_header = basic_authorization_header create(:user).email, "test" # check can't see the redacted data - get relation_version_path(:id => relation_v3.relation_id, :version => relation_v3.version), :headers => auth_header + get api_old_relation_path(:id => relation_v3.relation_id, :version => relation_v3.version), :headers => auth_header assert_response :forbidden, "Redacted relation shouldn't be visible via the version API." # and when accessed via history @@ -248,7 +248,7 @@ module Api # check moderator can still see the redacted data, without passing # the appropriate flag - get relation_version_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header + get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header assert_response :success, "After unredaction, relation should not be gone for moderator." # and when accessed via history @@ -260,7 +260,7 @@ module Api auth_header = basic_authorization_header create(:user).email, "test" # check normal user can now see the redacted data - get relation_version_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header + get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header assert_response :success, "After redaction, node should not be gone for normal user." # and when accessed via history @@ -329,7 +329,7 @@ module Api end def do_redact_relation(relation, redaction, headers = {}) - get relation_version_path(:id => relation.relation_id, :version => relation.version) + get api_old_relation_path(:id => relation.relation_id, :version => relation.version) assert_response :success, "should be able to get version #{relation.version} of relation #{relation.relation_id}." # now redact it diff --git a/test/controllers/api/old_ways_controller_test.rb b/test/controllers/api/old_ways_controller_test.rb index ca2cccd0f..959c3514a 100644 --- a/test/controllers/api/old_ways_controller_test.rb +++ b/test/controllers/api/old_ways_controller_test.rb @@ -163,12 +163,12 @@ module Api way_v1 = way.old_ways.find_by(:version => 1) way_v1.redact!(create(:redaction)) - get way_version_path(:id => way_v1.way_id, :version => way_v1.version) + get api_old_way_path(:id => way_v1.way_id, :version => way_v1.version) assert_response :forbidden, "Redacted way shouldn't be visible via the version API." # not even to a logged-in user auth_header = basic_authorization_header create(:user).email, "test" - get way_version_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header + get api_old_way_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header assert_response :forbidden, "Redacted way shouldn't be visible via the version API, even when logged in." end @@ -186,7 +186,6 @@ module Api # not even to a logged-in user auth_header = basic_authorization_header create(:user).email, "test" - get way_version_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header get api_way_history_path(:id => way_v1.way_id), :headers => auth_header assert_response :success, "Redaction shouldn't have stopped history working." assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 0, @@ -206,9 +205,9 @@ module Api # check moderator can still see the redacted data, when passing # the appropriate flag - get way_version_path(:id => way_v3.way_id, :version => way_v3.version), :headers => auth_header + get api_old_way_path(:id => way_v3.way_id, :version => way_v3.version), :headers => auth_header assert_response :forbidden, "After redaction, node should be gone for moderator, when flag not passed." - get way_version_path(:id => way_v3.way_id, :version => way_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header + get api_old_way_path(:id => way_v3.way_id, :version => way_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header assert_response :success, "After redaction, node should not be gone for moderator, when flag passed." # and when accessed via history @@ -236,7 +235,7 @@ module Api auth_header = basic_authorization_header create(:user).email, "test" # check can't see the redacted data - get way_version_path(:id => way_v3.way_id, :version => way_v3.version), :headers => auth_header + get api_old_way_path(:id => way_v3.way_id, :version => way_v3.version), :headers => auth_header assert_response :forbidden, "Redacted node shouldn't be visible via the version API." # and when accessed via history @@ -288,7 +287,7 @@ module Api # check moderator can still see the unredacted data, without passing # the appropriate flag - get way_version_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header + get api_old_way_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header assert_response :success, "After unredaction, node should not be gone for moderator." # and when accessed via history @@ -300,7 +299,7 @@ module Api auth_header = basic_authorization_header create(:user).email, "test" # check normal user can now see the unredacted data - get way_version_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header + get api_old_way_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header assert_response :success, "After redaction, node should not be gone for moderator, when flag passed." # and when accessed via history @@ -325,7 +324,7 @@ module Api assert_not_nil current_way, "getting way #{way_id} returned nil" # get the "old" version of the way from the version method - get way_version_path(:id => way_id, :version => current_way.version) + get api_old_way_path(:id => way_id, :version => current_way.version) assert_response :success, "can't get old way #{way_id}, v#{current_way.version}" old_way = Way.from_xml(@response.body) @@ -346,7 +345,7 @@ module Api history_way = Way.from_xml_node(way_doc) assert_not_nil history_way, "parsing way #{way_id} version failed" - get way_version_path(:id => way_id, :version => history_way.version) + get api_old_way_path(:id => way_id, :version => history_way.version) assert_response :success, "couldn't get way #{way_id}, v#{history_way.version}" version_way = Way.from_xml(@response.body) assert_not_nil version_way, "failed to parse #{way_id}, v#{history_way.version}" @@ -369,7 +368,7 @@ module Api end def do_redact_way(way, redaction, headers = {}) - get way_version_path(:id => way.way_id, :version => way.version) + get api_old_way_path(:id => way.way_id, :version => way.version) assert_response :success, "should be able to get version #{way.version} of way #{way.way_id}." # now redact it diff --git a/test/controllers/api/relations_controller_test.rb b/test/controllers/api/relations_controller_test.rb index e6f507d3a..7ff369fa4 100644 --- a/test/controllers/api/relations_controller_test.rb +++ b/test/controllers/api/relations_controller_test.rb @@ -788,7 +788,7 @@ module Api # check the ordering in the history tables: with_controller(OldRelationsController.new) do - get relation_version_path(:id => relation_id, :version => 2) + get api_old_relation_path(:id => relation_id, :version => 2) assert_response :success, "can't read back version 2 of the relation #{relation_id}" check_ordering(doc, @response.body) end @@ -868,7 +868,7 @@ module Api # check the ordering in the history tables: with_controller(OldRelationsController.new) do - get relation_version_path(:id => relation_id, :version => 1) + get api_old_relation_path(:id => relation_id, :version => 1) assert_response :success, "can't read back version 1 of the relation: #{@response.body}" check_ordering(doc, @response.body) end @@ -1109,7 +1109,7 @@ module Api get api_relation_path(:id => id) else with_controller(OldRelationsController.new) do - get relation_version_path(:id => id, :version => ver) + get api_old_relation_path(:id => id, :version => ver) end end assert_response :success diff --git a/test/controllers/old_nodes_controller_test.rb b/test/controllers/old_nodes_controller_test.rb index a1232be76..81a98766a 100644 --- a/test/controllers/old_nodes_controller_test.rb +++ b/test/controllers/old_nodes_controller_test.rb @@ -17,7 +17,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest assert_select "h4", /^Version/ do assert_select "a[href='#{old_node_path node, 1}']", :count => 0 end - assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{api_old_node_path node, 1}']", :count => 1 assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1 assert_select ".secondary-actions a[href='#{old_node_path node, 1, :params => { :show_redactions => true }}']", :count => 0 assert_select ".secondary-actions a[href='#{node_history_path node}']", :count => 1 @@ -32,7 +32,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest assert_select "h4", /^Version/ do assert_select "a[href='#{old_node_path node, 1}']", :count => 0 end - assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{api_old_node_path node, 1}']", :count => 1 assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1 assert_select ".secondary-actions a[href='#{node_history_path node}']", :count => 1 assert_select ".secondary-actions a[href='#{old_node_path node, 2}']", :count => 1 @@ -44,7 +44,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest assert_select "h4", /^Version/ do assert_select "a[href='#{old_node_path node, 2}']", :count => 0 end - assert_select ".secondary-actions a[href='#{node_version_path node, 2}']", :count => 1 + assert_select ".secondary-actions a[href='#{api_old_node_path node, 2}']", :count => 1 assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1 assert_select ".secondary-actions a[href='#{node_history_path node}']", :count => 1 assert_select ".secondary-actions a[href='#{old_node_path node, 1}']", :count => 1 @@ -60,7 +60,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1 assert_select ".secondary-actions a[href='#{old_node_path node, 1, :params => { :show_redactions => true }}']", :count => 0 assert_select ".secondary-actions a[href='#{old_node_path node, 1}']", :count => 0 - assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 0 + assert_select ".secondary-actions a[href='#{api_old_node_path node, 1}']", :count => 0 end test "show unrevealed redacted versions to regular users" do @@ -74,7 +74,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1 assert_select ".secondary-actions a[href='#{old_node_path node, 1, :params => { :show_redactions => true }}']", :count => 0 assert_select ".secondary-actions a[href='#{old_node_path node, 1}']", :count => 0 - assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 0 + assert_select ".secondary-actions a[href='#{api_old_node_path node, 1}']", :count => 0 end test "show unrevealed redacted versions to moderators" do @@ -88,7 +88,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1 assert_select ".secondary-actions a[href='#{old_node_path node, 1, :params => { :show_redactions => true }}']", :count => 1 assert_select ".secondary-actions a[href='#{old_node_path node, 1}']", :count => 0 - assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 0 + assert_select ".secondary-actions a[href='#{api_old_node_path node, 1}']", :count => 0 end test "don't reveal redacted versions to anonymous users" do diff --git a/test/controllers/old_relations_controller_test.rb b/test/controllers/old_relations_controller_test.rb index 6eb6db9dd..66a960e6f 100644 --- a/test/controllers/old_relations_controller_test.rb +++ b/test/controllers/old_relations_controller_test.rb @@ -17,7 +17,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest assert_select "h4", /^Version/ do assert_select "a[href='#{old_relation_path relation, 1}']", :count => 0 end - assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 1 assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1 assert_select ".secondary-actions a[href='#{old_relation_path relation, 1, :params => { :show_redactions => true }}']", :count => 0 assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1 @@ -32,7 +32,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest assert_select "h4", /^Version/ do assert_select "a[href='#{old_relation_path relation, 1}']", :count => 0 end - assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 1 assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1 assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1 assert_select ".secondary-actions a[href='#{old_relation_path relation, 2}']", :count => 1 @@ -44,7 +44,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest assert_select "h4", /^Version/ do assert_select "a[href='#{old_relation_path relation, 2}']", :count => 0 end - assert_select ".secondary-actions a[href='#{relation_version_path relation, 2}']", :count => 1 + assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 2}']", :count => 1 assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1 assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1 assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 1 @@ -69,7 +69,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1 assert_select ".secondary-actions a[href='#{old_relation_path relation, 1, :params => { :show_redactions => true }}']", :count => 0 assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 0 - assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 0 + assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 0 end test "show unrevealed redacted versions to regular users" do @@ -83,7 +83,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1 assert_select ".secondary-actions a[href='#{old_relation_path relation, 1, :params => { :show_redactions => true }}']", :count => 0 assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 0 - assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 0 + assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 0 end test "show unrevealed redacted versions to moderators" do @@ -97,7 +97,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1 assert_select ".secondary-actions a[href='#{old_relation_path relation, 1, :params => { :show_redactions => true }}']", :count => 1 assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 0 - assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 0 + assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 0 end test "don't reveal redacted versions to anonymous users" do diff --git a/test/controllers/old_ways_controller_test.rb b/test/controllers/old_ways_controller_test.rb index d28a23ef5..65e26ef20 100644 --- a/test/controllers/old_ways_controller_test.rb +++ b/test/controllers/old_ways_controller_test.rb @@ -17,7 +17,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest assert_select "h4", /^Version/ do assert_select "a[href='#{old_way_path way, 1}']", :count => 0 end - assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{api_old_way_path way, 1}']", :count => 1 assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1 assert_select ".secondary-actions a[href='#{old_way_path way, 1, :params => { :show_redactions => true }}']", :count => 0 assert_select ".secondary-actions a[href='#{way_history_path way}']", :count => 1 @@ -32,7 +32,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest assert_select "h4", /^Version/ do assert_select "a[href='#{old_way_path way, 1}']", :count => 0 end - assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{api_old_way_path way, 1}']", :count => 1 assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1 assert_select ".secondary-actions a[href='#{way_history_path way}']", :count => 1 assert_select ".secondary-actions a[href='#{old_way_path way, 2}']", :count => 1 @@ -44,7 +44,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest assert_select "h4", /^Version/ do assert_select "a[href='#{old_way_path way, 2}']", :count => 0 end - assert_select ".secondary-actions a[href='#{way_version_path way, 2}']", :count => 1 + assert_select ".secondary-actions a[href='#{api_old_way_path way, 2}']", :count => 1 assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1 assert_select ".secondary-actions a[href='#{way_history_path way}']", :count => 1 assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 1 @@ -74,7 +74,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1 assert_select ".secondary-actions a[href='#{old_way_path way, 1, :params => { :show_redactions => true }}']", :count => 0 assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 0 - assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 0 + assert_select ".secondary-actions a[href='#{api_old_way_path way, 1}']", :count => 0 end test "show unrevealed redacted versions to regular users" do @@ -88,7 +88,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1 assert_select ".secondary-actions a[href='#{old_way_path way, 1, :params => { :show_redactions => true }}']", :count => 0 assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 0 - assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 0 + assert_select ".secondary-actions a[href='#{api_old_way_path way, 1}']", :count => 0 end test "show unrevealed redacted versions to moderators" do @@ -102,7 +102,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1 assert_select ".secondary-actions a[href='#{old_way_path way, 1, :params => { :show_redactions => true }}']", :count => 1 assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 0 - assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 0 + assert_select ".secondary-actions a[href='#{api_old_way_path way, 1}']", :count => 0 end test "don't reveal redacted versions to anonymous users" do