Merge remote-tracking branch 'upstream/pull/2052'
This commit is contained in:
commit
70d6880e10
35 changed files with 164 additions and 169 deletions
|
@ -1508,7 +1508,7 @@ CHANGESET
|
|||
changeset_id = @response.body.to_i
|
||||
|
||||
# add a single node to it
|
||||
with_controller(NodeController.new) do
|
||||
with_controller(NodesController.new) do
|
||||
content "<osm><node lon='1' lat='2' changeset='#{changeset_id}'/></osm>"
|
||||
put :create
|
||||
assert_response :success, "Couldn't create node."
|
||||
|
@ -1523,7 +1523,7 @@ CHANGESET
|
|||
assert_select "osm>changeset[max_lat='2.0000000']", 1
|
||||
|
||||
# add another node to it
|
||||
with_controller(NodeController.new) do
|
||||
with_controller(NodesController.new) do
|
||||
content "<osm><node lon='2' lat='1' changeset='#{changeset_id}'/></osm>"
|
||||
put :create
|
||||
assert_response :success, "Couldn't create second node."
|
||||
|
@ -1538,7 +1538,7 @@ CHANGESET
|
|||
assert_select "osm>changeset[max_lat='2.0000000']", 1
|
||||
|
||||
# add (delete) a way to it, which contains a point at (3,3)
|
||||
with_controller(WayController.new) do
|
||||
with_controller(WaysController.new) do
|
||||
content update_changeset(way.to_xml, changeset_id)
|
||||
put :delete, :params => { :id => way.id }
|
||||
assert_response :success, "Couldn't delete a way."
|
||||
|
@ -1818,7 +1818,7 @@ CHANGESET
|
|||
changeset.num_changes = Changeset::MAX_ELEMENTS - offset
|
||||
changeset.save!
|
||||
|
||||
with_controller(NodeController.new) do
|
||||
with_controller(NodesController.new) do
|
||||
# create a new node
|
||||
content "<osm><node changeset='#{cs_id}' lat='0.0' lon='0.0'/></osm>"
|
||||
put :create
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require "test_helper"
|
||||
|
||||
class DiaryEntryControllerTest < ActionController::TestCase
|
||||
class DiaryEntriesControllerTest < ActionController::TestCase
|
||||
include ActionView::Helpers::NumberHelper
|
||||
|
||||
def setup
|
||||
|
@ -16,86 +16,86 @@ class DiaryEntryControllerTest < ActionController::TestCase
|
|||
def test_routes
|
||||
assert_routing(
|
||||
{ :path => "/diary", :method => :get },
|
||||
{ :controller => "diary_entry", :action => "index" }
|
||||
{ :controller => "diary_entries", :action => "index" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/diary/language", :method => :get },
|
||||
{ :controller => "diary_entry", :action => "index", :language => "language" }
|
||||
{ :controller => "diary_entries", :action => "index", :language => "language" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/user/username/diary", :method => :get },
|
||||
{ :controller => "diary_entry", :action => "index", :display_name => "username" }
|
||||
{ :controller => "diary_entries", :action => "index", :display_name => "username" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/diary/friends", :method => :get },
|
||||
{ :controller => "diary_entry", :action => "index", :friends => true }
|
||||
{ :controller => "diary_entries", :action => "index", :friends => true }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/diary/nearby", :method => :get },
|
||||
{ :controller => "diary_entry", :action => "index", :nearby => true }
|
||||
{ :controller => "diary_entries", :action => "index", :nearby => true }
|
||||
)
|
||||
|
||||
assert_routing(
|
||||
{ :path => "/diary/rss", :method => :get },
|
||||
{ :controller => "diary_entry", :action => "rss", :format => :rss }
|
||||
{ :controller => "diary_entries", :action => "rss", :format => :rss }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/diary/language/rss", :method => :get },
|
||||
{ :controller => "diary_entry", :action => "rss", :language => "language", :format => :rss }
|
||||
{ :controller => "diary_entries", :action => "rss", :language => "language", :format => :rss }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/user/username/diary/rss", :method => :get },
|
||||
{ :controller => "diary_entry", :action => "rss", :display_name => "username", :format => :rss }
|
||||
{ :controller => "diary_entries", :action => "rss", :display_name => "username", :format => :rss }
|
||||
)
|
||||
|
||||
assert_routing(
|
||||
{ :path => "/user/username/diary/comments", :method => :get },
|
||||
{ :controller => "diary_entry", :action => "comments", :display_name => "username" }
|
||||
{ :controller => "diary_entries", :action => "comments", :display_name => "username" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/user/username/diary/comments/1", :method => :get },
|
||||
{ :controller => "diary_entry", :action => "comments", :display_name => "username", :page => "1" }
|
||||
{ :controller => "diary_entries", :action => "comments", :display_name => "username", :page => "1" }
|
||||
)
|
||||
|
||||
assert_routing(
|
||||
{ :path => "/diary/new", :method => :get },
|
||||
{ :controller => "diary_entry", :action => "new" }
|
||||
{ :controller => "diary_entries", :action => "new" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/diary/new", :method => :post },
|
||||
{ :controller => "diary_entry", :action => "new" }
|
||||
{ :controller => "diary_entries", :action => "new" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/user/username/diary/1", :method => :get },
|
||||
{ :controller => "diary_entry", :action => "show", :display_name => "username", :id => "1" }
|
||||
{ :controller => "diary_entries", :action => "show", :display_name => "username", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/user/username/diary/1/edit", :method => :get },
|
||||
{ :controller => "diary_entry", :action => "edit", :display_name => "username", :id => "1" }
|
||||
{ :controller => "diary_entries", :action => "edit", :display_name => "username", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/user/username/diary/1/edit", :method => :post },
|
||||
{ :controller => "diary_entry", :action => "edit", :display_name => "username", :id => "1" }
|
||||
{ :controller => "diary_entries", :action => "edit", :display_name => "username", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/user/username/diary/1/newcomment", :method => :post },
|
||||
{ :controller => "diary_entry", :action => "comment", :display_name => "username", :id => "1" }
|
||||
{ :controller => "diary_entries", :action => "comment", :display_name => "username", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/user/username/diary/1/hide", :method => :post },
|
||||
{ :controller => "diary_entry", :action => "hide", :display_name => "username", :id => "1" }
|
||||
{ :controller => "diary_entries", :action => "hide", :display_name => "username", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/user/username/diary/1/hidecomment/2", :method => :post },
|
||||
{ :controller => "diary_entry", :action => "hidecomment", :display_name => "username", :id => "1", :comment => "2" }
|
||||
{ :controller => "diary_entries", :action => "hidecomment", :display_name => "username", :id => "1", :comment => "2" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/user/username/diary/1/subscribe", :method => :post },
|
||||
{ :controller => "diary_entry", :action => "subscribe", :display_name => "username", :id => "1" }
|
||||
{ :controller => "diary_entries", :action => "subscribe", :display_name => "username", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/user/username/diary/1/unsubscribe", :method => :post },
|
||||
{ :controller => "diary_entry", :action => "unsubscribe", :display_name => "username", :id => "1" }
|
||||
{ :controller => "diary_entries", :action => "unsubscribe", :display_name => "username", :id => "1" }
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -316,7 +316,7 @@ class DiaryEntryControllerTest < ActionController::TestCase
|
|||
:params => { :display_name => entry.user.display_name, :id => entry.id },
|
||||
:session => { :user => entry.user }
|
||||
assert_response :success
|
||||
assert_template "diary_entry/show"
|
||||
assert_template "show"
|
||||
assert_select "title", :text => /Users' diaries | /, :count => 1
|
||||
assert_select "div.content-heading", :count => 1 do
|
||||
assert_select "h2", :text => /#{entry.user.display_name}'s diary/, :count => 1
|
||||
|
@ -337,7 +337,7 @@ class DiaryEntryControllerTest < ActionController::TestCase
|
|||
:params => { :display_name => entry.user.display_name, :id => entry.id },
|
||||
:session => { :user => create(:user) }
|
||||
assert_response :success
|
||||
assert_template "diary_entry/show"
|
||||
assert_template "show"
|
||||
assert_select "title", :text => /Users' diaries | /, :count => 1
|
||||
assert_select "div.content-heading", :count => 1 do
|
||||
assert_select "h2", :text => /#{entry.user.display_name}'s diary/, :count => 1
|
|
@ -1,28 +1,28 @@
|
|||
require "test_helper"
|
||||
|
||||
class NodeControllerTest < ActionController::TestCase
|
||||
class NodesControllerTest < ActionController::TestCase
|
||||
##
|
||||
# test all routes which lead to this controller
|
||||
def test_routes
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/node/create", :method => :put },
|
||||
{ :controller => "node", :action => "create" }
|
||||
{ :controller => "nodes", :action => "create" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/node/1", :method => :get },
|
||||
{ :controller => "node", :action => "read", :id => "1" }
|
||||
{ :controller => "nodes", :action => "read", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/node/1", :method => :put },
|
||||
{ :controller => "node", :action => "update", :id => "1" }
|
||||
{ :controller => "nodes", :action => "update", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/node/1", :method => :delete },
|
||||
{ :controller => "node", :action => "delete", :id => "1" }
|
||||
{ :controller => "nodes", :action => "delete", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/nodes", :method => :get },
|
||||
{ :controller => "node", :action => "nodes" }
|
||||
{ :controller => "nodes", :action => "nodes" }
|
||||
)
|
||||
end
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
require "test_helper"
|
||||
require "old_node_controller"
|
||||
|
||||
class OldNodeControllerTest < ActionController::TestCase
|
||||
class OldNodesControllerTest < ActionController::TestCase
|
||||
#
|
||||
# TODO: test history
|
||||
#
|
||||
|
@ -11,15 +10,15 @@ class OldNodeControllerTest < ActionController::TestCase
|
|||
def test_routes
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/node/1/history", :method => :get },
|
||||
{ :controller => "old_node", :action => "history", :id => "1" }
|
||||
{ :controller => "old_nodes", :action => "history", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/node/1/2", :method => :get },
|
||||
{ :controller => "old_node", :action => "version", :id => "1", :version => "2" }
|
||||
{ :controller => "old_nodes", :action => "version", :id => "1", :version => "2" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/node/1/2/redact", :method => :post },
|
||||
{ :controller => "old_node", :action => "redact", :id => "1", :version => "2" }
|
||||
{ :controller => "old_nodes", :action => "redact", :id => "1", :version => "2" }
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -59,7 +58,7 @@ class OldNodeControllerTest < ActionController::TestCase
|
|||
# move the node somewhere else
|
||||
xml_node["lat"] = precision(rand * 180 - 90).to_s
|
||||
xml_node["lon"] = precision(rand * 360 - 180).to_s
|
||||
with_controller(NodeController.new) do
|
||||
with_controller(NodesController.new) do
|
||||
content xml_doc
|
||||
put :update, :params => { :id => nodeid }
|
||||
assert_response :forbidden, "Should have rejected node update"
|
||||
|
@ -75,7 +74,7 @@ class OldNodeControllerTest < ActionController::TestCase
|
|||
xml_tag["k"] = random_string
|
||||
xml_tag["v"] = random_string
|
||||
xml_node << xml_tag
|
||||
with_controller(NodeController.new) do
|
||||
with_controller(NodesController.new) do
|
||||
content xml_doc
|
||||
put :update, :params => { :id => nodeid }
|
||||
assert_response :forbidden,
|
||||
|
@ -109,7 +108,7 @@ class OldNodeControllerTest < ActionController::TestCase
|
|||
# move the node somewhere else
|
||||
xml_node["lat"] = precision(rand * 180 - 90).to_s
|
||||
xml_node["lon"] = precision(rand * 360 - 180).to_s
|
||||
with_controller(NodeController.new) do
|
||||
with_controller(NodesController.new) do
|
||||
content xml_doc
|
||||
put :update, :params => { :id => nodeid }
|
||||
assert_response :success
|
||||
|
@ -125,7 +124,7 @@ class OldNodeControllerTest < ActionController::TestCase
|
|||
xml_tag["k"] = random_string
|
||||
xml_tag["v"] = random_string
|
||||
xml_node << xml_tag
|
||||
with_controller(NodeController.new) do
|
||||
with_controller(NodesController.new) do
|
||||
content xml_doc
|
||||
put :update, :params => { :id => nodeid }
|
||||
assert_response :success,
|
||||
|
@ -390,7 +389,7 @@ class OldNodeControllerTest < ActionController::TestCase
|
|||
|
||||
def check_current_version(node_id)
|
||||
# get the current version of the node
|
||||
current_node = with_controller(NodeController.new) do
|
||||
current_node = with_controller(NodesController.new) do
|
||||
get :read, :params => { :id => node_id }
|
||||
assert_response :success, "cant get current node #{node_id}"
|
||||
Node.from_xml(@response.body)
|
|
@ -1,21 +1,20 @@
|
|||
require "test_helper"
|
||||
require "old_relation_controller"
|
||||
|
||||
class OldRelationControllerTest < ActionController::TestCase
|
||||
class OldRelationsControllerTest < ActionController::TestCase
|
||||
##
|
||||
# test all routes which lead to this controller
|
||||
def test_routes
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/relation/1/history", :method => :get },
|
||||
{ :controller => "old_relation", :action => "history", :id => "1" }
|
||||
{ :controller => "old_relations", :action => "history", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/relation/1/2", :method => :get },
|
||||
{ :controller => "old_relation", :action => "version", :id => "1", :version => "2" }
|
||||
{ :controller => "old_relations", :action => "version", :id => "1", :version => "2" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/relation/1/2/redact", :method => :post },
|
||||
{ :controller => "old_relation", :action => "redact", :id => "1", :version => "2" }
|
||||
{ :controller => "old_relations", :action => "redact", :id => "1", :version => "2" }
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -225,7 +224,7 @@ class OldRelationControllerTest < ActionController::TestCase
|
|||
# version which we're getting from the versions call.
|
||||
def check_current_version(relation_id)
|
||||
# get the current version
|
||||
current_relation = with_controller(RelationController.new) do
|
||||
current_relation = with_controller(RelationsController.new) do
|
||||
get :read, :params => { :id => relation_id }
|
||||
assert_response :success, "can't get current relation #{relation_id}"
|
||||
Relation.from_xml(@response.body)
|
|
@ -1,21 +1,20 @@
|
|||
require "test_helper"
|
||||
require "old_way_controller"
|
||||
|
||||
class OldWayControllerTest < ActionController::TestCase
|
||||
class OldWaysControllerTest < ActionController::TestCase
|
||||
##
|
||||
# test all routes which lead to this controller
|
||||
def test_routes
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/way/1/history", :method => :get },
|
||||
{ :controller => "old_way", :action => "history", :id => "1" }
|
||||
{ :controller => "old_ways", :action => "history", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/way/1/2", :method => :get },
|
||||
{ :controller => "old_way", :action => "version", :id => "1", :version => "2" }
|
||||
{ :controller => "old_ways", :action => "version", :id => "1", :version => "2" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/way/1/2/redact", :method => :post },
|
||||
{ :controller => "old_way", :action => "redact", :id => "1", :version => "2" }
|
||||
{ :controller => "old_ways", :action => "redact", :id => "1", :version => "2" }
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -265,7 +264,7 @@ class OldWayControllerTest < ActionController::TestCase
|
|||
# version which we're getting from the versions call.
|
||||
def check_current_version(way_id)
|
||||
# get the current version
|
||||
current_way = with_controller(WayController.new) do
|
||||
current_way = with_controller(WaysController.new) do
|
||||
get :read, :params => { :id => way_id }
|
||||
assert_response :success, "can't get current way #{way_id}"
|
||||
Way.from_xml(@response.body)
|
|
@ -1,46 +1,45 @@
|
|||
require "test_helper"
|
||||
require "relation_controller"
|
||||
|
||||
class RelationControllerTest < ActionController::TestCase
|
||||
class RelationsControllerTest < ActionController::TestCase
|
||||
##
|
||||
# test all routes which lead to this controller
|
||||
def test_routes
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/relation/create", :method => :put },
|
||||
{ :controller => "relation", :action => "create" }
|
||||
{ :controller => "relations", :action => "create" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/relation/1/full", :method => :get },
|
||||
{ :controller => "relation", :action => "full", :id => "1" }
|
||||
{ :controller => "relations", :action => "full", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/relation/1", :method => :get },
|
||||
{ :controller => "relation", :action => "read", :id => "1" }
|
||||
{ :controller => "relations", :action => "read", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/relation/1", :method => :put },
|
||||
{ :controller => "relation", :action => "update", :id => "1" }
|
||||
{ :controller => "relations", :action => "update", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/relation/1", :method => :delete },
|
||||
{ :controller => "relation", :action => "delete", :id => "1" }
|
||||
{ :controller => "relations", :action => "delete", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/relations", :method => :get },
|
||||
{ :controller => "relation", :action => "relations" }
|
||||
{ :controller => "relations", :action => "relations" }
|
||||
)
|
||||
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/node/1/relations", :method => :get },
|
||||
{ :controller => "relation", :action => "relations_for_node", :id => "1" }
|
||||
{ :controller => "relations", :action => "relations_for_node", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/way/1/relations", :method => :get },
|
||||
{ :controller => "relation", :action => "relations_for_way", :id => "1" }
|
||||
{ :controller => "relations", :action => "relations_for_way", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/relation/1/relations", :method => :get },
|
||||
{ :controller => "relation", :action => "relations_for_relation", :id => "1" }
|
||||
{ :controller => "relations", :action => "relations_for_relation", :id => "1" }
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -785,7 +784,7 @@ OSM
|
|||
check_ordering(doc, @response.body)
|
||||
|
||||
# check the ordering in the history tables:
|
||||
with_controller(OldRelationController.new) do
|
||||
with_controller(OldRelationsController.new) do
|
||||
get :version, :params => { :id => relation_id, :version => 2 }
|
||||
assert_response :success, "can't read back version 2 of the relation #{relation_id}"
|
||||
check_ordering(doc, @response.body)
|
||||
|
@ -868,7 +867,7 @@ OSM
|
|||
check_ordering(doc, @response.body)
|
||||
|
||||
# check the ordering in the history tables:
|
||||
with_controller(OldRelationController.new) do
|
||||
with_controller(OldRelationsController.new) do
|
||||
get :version, :params => { :id => relation_id, :version => 1 }
|
||||
assert_response :success, "can't read back version 1 of the relation: #{@response.body}"
|
||||
check_ordering(doc, @response.body)
|
||||
|
@ -982,7 +981,7 @@ OSM
|
|||
if ver.nil?
|
||||
get :read, :params => { :id => id }
|
||||
else
|
||||
with_controller(OldRelationController.new) do
|
||||
with_controller(OldRelationsController.new) do
|
||||
get :version, :params => { :id => id, :version => ver }
|
||||
end
|
||||
end
|
|
@ -1,33 +1,32 @@
|
|||
require "test_helper"
|
||||
require "way_controller"
|
||||
|
||||
class WayControllerTest < ActionController::TestCase
|
||||
class WaysControllerTest < ActionController::TestCase
|
||||
##
|
||||
# test all routes which lead to this controller
|
||||
def test_routes
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/way/create", :method => :put },
|
||||
{ :controller => "way", :action => "create" }
|
||||
{ :controller => "ways", :action => "create" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/way/1/full", :method => :get },
|
||||
{ :controller => "way", :action => "full", :id => "1" }
|
||||
{ :controller => "ways", :action => "full", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/way/1", :method => :get },
|
||||
{ :controller => "way", :action => "read", :id => "1" }
|
||||
{ :controller => "ways", :action => "read", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/way/1", :method => :put },
|
||||
{ :controller => "way", :action => "update", :id => "1" }
|
||||
{ :controller => "ways", :action => "update", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/way/1", :method => :delete },
|
||||
{ :controller => "way", :action => "delete", :id => "1" }
|
||||
{ :controller => "ways", :action => "delete", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/api/0.6/ways", :method => :get },
|
||||
{ :controller => "way", :action => "ways" }
|
||||
{ :controller => "ways", :action => "ways" }
|
||||
)
|
||||
end
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue