Add routing tests for all supported routes
This commit is contained in:
parent
b012617608
commit
90e46a58de
24 changed files with 1028 additions and 16 deletions
|
@ -5,6 +5,19 @@ include Potlatch
|
||||||
class AmfControllerTest < ActionController::TestCase
|
class AmfControllerTest < ActionController::TestCase
|
||||||
api_fixtures
|
api_fixtures
|
||||||
|
|
||||||
|
##
|
||||||
|
# test all routes which lead to this controller
|
||||||
|
def test_routes
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/amf/read", :method => :post },
|
||||||
|
{ :controller => "amf", :action => "amf_read" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/amf/write", :method => :post },
|
||||||
|
{ :controller => "amf", :action => "amf_write" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
def test_getway
|
def test_getway
|
||||||
# check a visible way
|
# check a visible way
|
||||||
id = current_ways(:visible_way).id
|
id = current_ways(:visible_way).id
|
||||||
|
|
|
@ -18,6 +18,31 @@ class ApiControllerTest < ActionController::TestCase
|
||||||
# reall reject it, however this is to test to see if the api changes.
|
# reall reject it, however this is to test to see if the api changes.
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# test all routes which lead to this controller
|
||||||
|
def test_routes
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/capabilities", :method => :get },
|
||||||
|
{ :controller => "api", :action => "capabilities" }
|
||||||
|
)
|
||||||
|
assert_recognizes(
|
||||||
|
{ :controller => "api", :action => "capabilities" },
|
||||||
|
{ :path => "/api/0.6/capabilities", :method => :get }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/map", :method => :get },
|
||||||
|
{ :controller => "api", :action => "map" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/trackpoints", :method => :get },
|
||||||
|
{ :controller => "api", :action => "trackpoints" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/changes", :method => :get },
|
||||||
|
{ :controller => "api", :action => "changes" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
# Test reading a bounding box.
|
# Test reading a bounding box.
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
|
|
|
@ -4,6 +4,43 @@ require 'browse_controller'
|
||||||
class BrowseControllerTest < ActionController::TestCase
|
class BrowseControllerTest < ActionController::TestCase
|
||||||
api_fixtures
|
api_fixtures
|
||||||
|
|
||||||
|
##
|
||||||
|
# test all routes which lead to this controller
|
||||||
|
def test_routes
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/browse/start", :method => :get },
|
||||||
|
{ :controller => "browse", :action => "start" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/browse/node/1", :method => :get },
|
||||||
|
{ :controller => "browse", :action => "node", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/browse/node/1/history", :method => :get },
|
||||||
|
{ :controller => "browse", :action => "node_history", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/browse/way/1", :method => :get },
|
||||||
|
{ :controller => "browse", :action => "way", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/browse/way/1/history", :method => :get },
|
||||||
|
{ :controller => "browse", :action => "way_history", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/browse/relation/1", :method => :get },
|
||||||
|
{ :controller => "browse", :action => "relation", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/browse/relation/1/history", :method => :get },
|
||||||
|
{ :controller => "browse", :action => "relation_history", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/browse/changeset/1", :method => :get },
|
||||||
|
{ :controller => "browse", :action => "changeset", :id => "1" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
def test_start
|
def test_start
|
||||||
xhr :get, :start
|
xhr :get, :start
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
|
@ -4,6 +4,79 @@ require 'changeset_controller'
|
||||||
class ChangesetControllerTest < ActionController::TestCase
|
class ChangesetControllerTest < ActionController::TestCase
|
||||||
api_fixtures
|
api_fixtures
|
||||||
|
|
||||||
|
##
|
||||||
|
# test all routes which lead to this controller
|
||||||
|
def test_routes
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/changeset/create", :method => :put },
|
||||||
|
{ :controller => "changeset", :action => "create" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/changeset/1/upload", :method => :post },
|
||||||
|
{ :controller => "changeset", :action => "upload", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/changeset/1/download", :method => :get },
|
||||||
|
{ :controller => "changeset", :action => "download", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/changeset/1/expand_bbox", :method => :post },
|
||||||
|
{ :controller => "changeset", :action => "expand_bbox", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/changeset/1", :method => :get },
|
||||||
|
{ :controller => "changeset", :action => "read", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/changeset/1", :method => :put },
|
||||||
|
{ :controller => "changeset", :action => "update", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/changeset/1/close", :method => :put },
|
||||||
|
{ :controller => "changeset", :action => "close", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/changesets", :method => :get },
|
||||||
|
{ :controller => "changeset", :action => "query" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/name/edits", :method => :get },
|
||||||
|
{ :controller => "changeset", :action => "list", :display_name => "name" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/name/edits/feed", :method => :get },
|
||||||
|
{ :controller => "changeset", :action => "feed", :display_name => "name", :format => :atom }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/browse/friends", :method => :get },
|
||||||
|
{ :controller => "changeset", :action => "list", :friends => true }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/browse/nearby", :method => :get },
|
||||||
|
{ :controller => "changeset", :action => "list", :nearby => true }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/browse/changesets", :method => :get },
|
||||||
|
{ :controller => "changeset", :action => "list" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/browse/changesets/feed", :method => :get },
|
||||||
|
{ :controller => "changeset", :action => "feed", :format => :atom }
|
||||||
|
)
|
||||||
|
assert_recognizes(
|
||||||
|
{ :controller => "changeset", :action => "list" },
|
||||||
|
{ :path => "/browse", :method => :get }
|
||||||
|
)
|
||||||
|
assert_recognizes(
|
||||||
|
{ :controller => "changeset", :action => "list" },
|
||||||
|
{ :path => "/history", :method => :get }
|
||||||
|
)
|
||||||
|
assert_recognizes(
|
||||||
|
{ :controller => "changeset", :action => "feed", :format => :atom },
|
||||||
|
{ :path => "/history/feed", :method => :get }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
# -----------------------
|
# -----------------------
|
||||||
# Test simple changeset creation
|
# Test simple changeset creation
|
||||||
# -----------------------
|
# -----------------------
|
||||||
|
|
|
@ -5,6 +5,86 @@ class DiaryEntryControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
include ActionView::Helpers::NumberHelper
|
include ActionView::Helpers::NumberHelper
|
||||||
|
|
||||||
|
##
|
||||||
|
# test all routes which lead to this controller
|
||||||
|
def test_routes
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/diary", :method => :get },
|
||||||
|
{ :controller => "diary_entry", :action => "list" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/diary/language", :method => :get },
|
||||||
|
{ :controller => "diary_entry", :action => "list", :language => "language" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/diary", :method => :get },
|
||||||
|
{ :controller => "diary_entry", :action => "list", :display_name => "username" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/diary/friends", :method => :get },
|
||||||
|
{ :controller => "diary_entry", :action => "list", :friends => true }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/diary/nearby", :method => :get },
|
||||||
|
{ :controller => "diary_entry", :action => "list", :nearby => true }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/diary/rss", :method => :get },
|
||||||
|
{ :controller => "diary_entry", :action => "rss", :format => :rss }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/diary/language/rss", :method => :get },
|
||||||
|
{ :controller => "diary_entry", :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 }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/diary/comments", :method => :get },
|
||||||
|
{ :controller => "diary_entry", :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" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/diary/new", :method => :get },
|
||||||
|
{ :controller => "diary_entry", :action => "new" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/diary/new", :method => :post },
|
||||||
|
{ :controller => "diary_entry", :action => "new" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/diary/1", :method => :get },
|
||||||
|
{ :controller => "diary_entry", :action => "view", :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" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/diary/1/edit", :method => :post },
|
||||||
|
{ :controller => "diary_entry", :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" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/diary/1/hide", :method => :post },
|
||||||
|
{ :controller => "diary_entry", :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" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
def test_showing_new_diary_entry
|
def test_showing_new_diary_entry
|
||||||
@request.cookies["_osm_username"] = users(:normal_user).display_name
|
@request.cookies["_osm_username"] = users(:normal_user).display_name
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,20 @@
|
||||||
require File.dirname(__FILE__) + '/../test_helper'
|
require File.dirname(__FILE__) + '/../test_helper'
|
||||||
|
|
||||||
class ExportControllerTest < ActionController::TestCase
|
class ExportControllerTest < ActionController::TestCase
|
||||||
# Replace this with your real tests.
|
|
||||||
|
##
|
||||||
|
# test all routes which lead to this controller
|
||||||
|
def test_routes
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/export/start", :method => :get },
|
||||||
|
{ :controller => "export", :action => "start" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/export/finish", :method => :post },
|
||||||
|
{ :controller => "export", :action => "finish" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
def test_start
|
def test_start
|
||||||
xhr :get, :start
|
xhr :get, :start
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
|
@ -2,9 +2,57 @@ require File.dirname(__FILE__) + '/../test_helper'
|
||||||
require 'geocoder_controller'
|
require 'geocoder_controller'
|
||||||
|
|
||||||
class GeocoderControllerTest < ActionController::TestCase
|
class GeocoderControllerTest < ActionController::TestCase
|
||||||
|
##
|
||||||
|
# test all routes which lead to this controller
|
||||||
|
def test_routes
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/geocoder/search", :method => :get },
|
||||||
|
{ :controller => "geocoder", :action => "search" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/geocoder/search_latlon", :method => :get },
|
||||||
|
{ :controller => "geocoder", :action => "search_latlon" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/geocoder/search_us_postcode", :method => :get },
|
||||||
|
{ :controller => "geocoder", :action => "search_us_postcode" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/geocoder/search_uk_postcode", :method => :get },
|
||||||
|
{ :controller => "geocoder", :action => "search_uk_postcode" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/geocoder/search_ca_postcode", :method => :get },
|
||||||
|
{ :controller => "geocoder", :action => "search_ca_postcode" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/geocoder/search_osm_namefinder", :method => :get },
|
||||||
|
{ :controller => "geocoder", :action => "search_osm_namefinder" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/geocoder/search_osm_nominatim", :method => :get },
|
||||||
|
{ :controller => "geocoder", :action => "search_osm_nominatim" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/geocoder/search_geonames", :method => :get },
|
||||||
|
{ :controller => "geocoder", :action => "search_geonames" }
|
||||||
|
)
|
||||||
|
|
||||||
# Replace this with your real tests.
|
assert_routing(
|
||||||
def test_truth
|
{ :path => "/geocoder/description", :method => :get },
|
||||||
assert true
|
{ :controller => "geocoder", :action => "description" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/geocoder/description_osm_namefinder", :method => :get },
|
||||||
|
{ :controller => "geocoder", :action => "description_osm_namefinder" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/geocoder/description_osm_nominatim", :method => :get },
|
||||||
|
{ :controller => "geocoder", :action => "description_osm_nominatim" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/geocoder/description_geonames", :method => :get },
|
||||||
|
{ :controller => "geocoder", :action => "description_geonames" }
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,9 +2,40 @@ require File.dirname(__FILE__) + '/../test_helper'
|
||||||
require 'message_controller'
|
require 'message_controller'
|
||||||
|
|
||||||
class MessageControllerTest < ActionController::TestCase
|
class MessageControllerTest < ActionController::TestCase
|
||||||
|
##
|
||||||
# Replace this with your real tests.
|
# test all routes which lead to this controller
|
||||||
def test_truth
|
def test_routes
|
||||||
assert true
|
assert_routing(
|
||||||
|
{ :path => "/user/username/inbox", :method => :get },
|
||||||
|
{ :controller => "message", :action => "inbox", :display_name => "username" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/outbox", :method => :get },
|
||||||
|
{ :controller => "message", :action => "outbox", :display_name => "username" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/message/new/username", :method => :get },
|
||||||
|
{ :controller => "message", :action => "new", :display_name => "username" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/message/new/username", :method => :post },
|
||||||
|
{ :controller => "message", :action => "new", :display_name => "username" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/message/read/1", :method => :get },
|
||||||
|
{ :controller => "message", :action => "read", :message_id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/message/mark/1", :method => :post },
|
||||||
|
{ :controller => "message", :action => "mark", :message_id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/message/reply/1", :method => :get },
|
||||||
|
{ :controller => "message", :action => "reply", :message_id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/message/delete/1", :method => :post },
|
||||||
|
{ :controller => "message", :action => "delete", :message_id => "1" }
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,6 +3,31 @@ require File.dirname(__FILE__) + '/../test_helper'
|
||||||
class NodeControllerTest < ActionController::TestCase
|
class NodeControllerTest < ActionController::TestCase
|
||||||
api_fixtures
|
api_fixtures
|
||||||
|
|
||||||
|
##
|
||||||
|
# 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" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/node/1", :method => :get },
|
||||||
|
{ :controller => "node", :action => "read", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/node/1", :method => :put },
|
||||||
|
{ :controller => "node", :action => "update", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/node/1", :method => :delete },
|
||||||
|
{ :controller => "node", :action => "delete", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/nodes", :method => :get },
|
||||||
|
{ :controller => "node", :action => "nodes" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
def test_create
|
def test_create
|
||||||
# cannot read password from fixture as it is stored as MD5 digest
|
# cannot read password from fixture as it is stored as MD5 digest
|
||||||
## First try with no auth
|
## First try with no auth
|
||||||
|
|
36
test/functional/oauth_clients_controller_test.rb
Normal file
36
test/functional/oauth_clients_controller_test.rb
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
require File.dirname(__FILE__) + '/../test_helper'
|
||||||
|
|
||||||
|
class OauthClientsControllerTest < ActionController::TestCase
|
||||||
|
##
|
||||||
|
# test all routes which lead to this controller
|
||||||
|
def test_routes
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/oauth_clients", :method => :get },
|
||||||
|
{ :controller => "oauth_clients", :action => "index", :display_name => "username" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/oauth_clients/new", :method => :get },
|
||||||
|
{ :controller => "oauth_clients", :action => "new", :display_name => "username" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/oauth_clients", :method => :post },
|
||||||
|
{ :controller => "oauth_clients", :action => "create", :display_name => "username" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/oauth_clients/1", :method => :get },
|
||||||
|
{ :controller => "oauth_clients", :action => "show", :display_name => "username", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/oauth_clients/1/edit", :method => :get },
|
||||||
|
{ :controller => "oauth_clients", :action => "edit", :display_name => "username", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/oauth_clients/1", :method => :put },
|
||||||
|
{ :controller => "oauth_clients", :action => "update", :display_name => "username", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/oauth_clients/1", :method => :delete },
|
||||||
|
{ :controller => "oauth_clients", :action => "destroy", :display_name => "username", :id => "1" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
32
test/functional/oauth_controller_test.rb
Normal file
32
test/functional/oauth_controller_test.rb
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
require File.dirname(__FILE__) + '/../test_helper'
|
||||||
|
|
||||||
|
class OauthControllerTest < ActionController::TestCase
|
||||||
|
##
|
||||||
|
# test all routes which lead to this controller
|
||||||
|
def test_routes
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/oauth/revoke" },
|
||||||
|
{ :controller => "oauth", :action => "revoke" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/oauth/authorize" },
|
||||||
|
{ :controller => "oauth", :action => "authorize" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/oauth/token" },
|
||||||
|
{ :controller => "oauth", :action => "token" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/oauth/request_token" },
|
||||||
|
{ :controller => "oauth", :action => "request_token" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/oauth/access_token" },
|
||||||
|
{ :controller => "oauth", :action => "access_token" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/oauth/test_request" },
|
||||||
|
{ :controller => "oauth", :action => "test_request" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
|
@ -8,6 +8,19 @@ class OldNodeControllerTest < ActionController::TestCase
|
||||||
# TODO: test history
|
# TODO: test history
|
||||||
#
|
#
|
||||||
|
|
||||||
|
##
|
||||||
|
# test all routes which lead to this controller
|
||||||
|
def test_routes
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/node/1/history", :method => :get },
|
||||||
|
{ :controller => "old_node", :action => "history", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/node/1/2", :method => :get },
|
||||||
|
{ :controller => "old_node", :action => "version", :id => "1", :version => "2" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# test the version call by submitting several revisions of a new node
|
# test the version call by submitting several revisions of a new node
|
||||||
# to the API and ensuring that later calls to version return the
|
# to the API and ensuring that later calls to version return the
|
||||||
|
|
|
@ -4,6 +4,19 @@ require 'old_relation_controller'
|
||||||
class OldRelationControllerTest < ActionController::TestCase
|
class OldRelationControllerTest < ActionController::TestCase
|
||||||
api_fixtures
|
api_fixtures
|
||||||
|
|
||||||
|
##
|
||||||
|
# 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" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/relation/1/2", :method => :get },
|
||||||
|
{ :controller => "old_relation", :action => "version", :id => "1", :version => "2" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
# Test reading old relations.
|
# Test reading old relations.
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
|
|
|
@ -4,6 +4,19 @@ require 'old_way_controller'
|
||||||
class OldWayControllerTest < ActionController::TestCase
|
class OldWayControllerTest < ActionController::TestCase
|
||||||
api_fixtures
|
api_fixtures
|
||||||
|
|
||||||
|
##
|
||||||
|
# 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" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/way/1/2", :method => :get },
|
||||||
|
{ :controller => "old_way", :action => "version", :id => "1", :version => "2" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
# Test reading old ways.
|
# Test reading old ways.
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
|
|
|
@ -4,6 +4,48 @@ require 'relation_controller'
|
||||||
class RelationControllerTest < ActionController::TestCase
|
class RelationControllerTest < ActionController::TestCase
|
||||||
api_fixtures
|
api_fixtures
|
||||||
|
|
||||||
|
##
|
||||||
|
# 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" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/relation/1/full", :method => :get },
|
||||||
|
{ :controller => "relation", :action => "full", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/relation/1", :method => :get },
|
||||||
|
{ :controller => "relation", :action => "read", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/relation/1", :method => :put },
|
||||||
|
{ :controller => "relation", :action => "update", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/relation/1", :method => :delete },
|
||||||
|
{ :controller => "relation", :action => "delete", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/relations", :method => :get },
|
||||||
|
{ :controller => "relation", :action => "relations" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/node/1/relations", :method => :get },
|
||||||
|
{ :controller => "relation", :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" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/relation/1/relations", :method => :get },
|
||||||
|
{ :controller => "relation", :action => "relations_for_relation", :id => "1" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
# Test reading relations.
|
# Test reading relations.
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
|
|
|
@ -1,8 +1,24 @@
|
||||||
require File.dirname(__FILE__) + '/../test_helper'
|
require File.dirname(__FILE__) + '/../test_helper'
|
||||||
|
|
||||||
class SearchControllerTest < ActionController::TestCase
|
class SearchControllerTest < ActionController::TestCase
|
||||||
# Replace this with your real tests.
|
##
|
||||||
def test_truth
|
# test all routes which lead to this controller
|
||||||
assert true
|
def test_routes
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/search", :method => :get },
|
||||||
|
{ :controller => "search", :action => "search_all" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/nodes/search", :method => :get },
|
||||||
|
{ :controller => "search", :action => "search_nodes" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/ways/search", :method => :get },
|
||||||
|
{ :controller => "search", :action => "search_ways" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/relations/search", :method => :get },
|
||||||
|
{ :controller => "search", :action => "search_relations" }
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,6 +3,55 @@ require File.dirname(__FILE__) + '/../test_helper'
|
||||||
class SiteControllerTest < ActionController::TestCase
|
class SiteControllerTest < ActionController::TestCase
|
||||||
fixtures :users
|
fixtures :users
|
||||||
|
|
||||||
|
##
|
||||||
|
# test all routes which lead to this controller
|
||||||
|
def test_routes
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/", :method => :get },
|
||||||
|
{ :controller => "site", :action => "index" }
|
||||||
|
)
|
||||||
|
assert_recognizes(
|
||||||
|
{ :controller => "site", :action => "index" },
|
||||||
|
{ :path => "/index.html", :method => :get }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/edit", :method => :get },
|
||||||
|
{ :controller => "site", :action => "edit" }
|
||||||
|
)
|
||||||
|
assert_recognizes(
|
||||||
|
{ :controller => "site", :action => "edit", :format => "html" },
|
||||||
|
{ :path => "/edit.html", :method => :get }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/copyright", :method => :get },
|
||||||
|
{ :controller => "site", :action => "copyright" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/copyright/locale", :method => :get },
|
||||||
|
{ :controller => "site", :action => "copyright", :copyright_locale => "locale" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/export", :method => :get },
|
||||||
|
{ :controller => "site", :action => "export" }
|
||||||
|
)
|
||||||
|
assert_recognizes(
|
||||||
|
{ :controller => "site", :action => "export", :format => "html" },
|
||||||
|
{ :path => "/export.html", :method => :get }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/offline", :method => :get },
|
||||||
|
{ :controller => "site", :action => "offline" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/key", :method => :get },
|
||||||
|
{ :controller => "site", :action => "key" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/go/shortcode", :method => :get },
|
||||||
|
{ :controller => "site", :action => "permalink", :code => "shortcode" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
## Lets check that we can get all the pages without any errors
|
## Lets check that we can get all the pages without any errors
|
||||||
# Get the index
|
# Get the index
|
||||||
def test_index
|
def test_index
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
require File.dirname(__FILE__) + '/../test_helper'
|
require File.dirname(__FILE__) + '/../test_helper'
|
||||||
|
|
||||||
class SwfControllerTest < ActionController::TestCase
|
class SwfControllerTest < ActionController::TestCase
|
||||||
# Replace this with your real tests.
|
##
|
||||||
def test_truth
|
# test all routes which lead to this controller
|
||||||
assert true
|
def test_routes
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/swf/trackpoints", :method => :get },
|
||||||
|
{ :controller => "swf", :action => "trackpoints" }
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,148 @@ class TraceControllerTest < ActionController::TestCase
|
||||||
fixtures :users, :gpx_files
|
fixtures :users, :gpx_files
|
||||||
set_fixture_class :gpx_files => 'Trace'
|
set_fixture_class :gpx_files => 'Trace'
|
||||||
|
|
||||||
|
##
|
||||||
|
# test all routes which lead to this controller
|
||||||
|
def test_routes
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/gpx/create", :method => :post },
|
||||||
|
{ :controller => "trace", :action => "api_create" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/gpx/1", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "api_read", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/gpx/1", :method => :put },
|
||||||
|
{ :controller => "trace", :action => "api_update", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/gpx/1", :method => :delete },
|
||||||
|
{ :controller => "trace", :action => "api_delete", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_recognizes(
|
||||||
|
{ :controller => "trace", :action => "api_read", :id => "1" },
|
||||||
|
{ :path => "/api/0.6/gpx/1/details", :method => :get }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/gpx/1/data", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "api_data", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/gpx/1/data.xml", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "api_data", :id => "1", :format => "xml" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/traces", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "list" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/traces/page/1", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "list", :page => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/traces/tag/tagname", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "list", :tag => "tagname" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/traces/tag/tagname/page/1", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "list", :tag => "tagname", :page => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/traces", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "list", :display_name => "username" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/traces/page/1", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "list", :display_name => "username", :page => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/traces/tag/tagname", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "list", :display_name => "username", :tag => "tagname" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/traces/tag/tagname/page/1", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "list", :display_name => "username", :tag => "tagname", :page => "1" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/traces/mine", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "mine" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/traces/mine/page/1", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "mine", :page => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/traces/mine/tag/tagname", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "mine", :tag => "tagname" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/traces/mine/tag/tagname/page/1", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "mine", :tag => "tagname", :page => "1" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/traces/rss", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "georss" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/traces/tag/tagname/rss", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "georss", :tag => "tagname" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/traces/rss", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "georss", :display_name => "username" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/traces/tag/tagname/rss", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "georss", :display_name => "username", :tag => "tagname" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/traces/1", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "view", :display_name => "username", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/traces/1/picture", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "picture", :display_name => "username", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/traces/1/icon", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "icon", :display_name => "username", :id => "1" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/trace/create", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "create" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/trace/create", :method => :post },
|
||||||
|
{ :controller => "trace", :action => "create" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/trace/1/data", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "data", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/trace/1/data.xml", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "data", :id => "1", :format => "xml" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/trace/1/edit", :method => :get },
|
||||||
|
{ :controller => "trace", :action => "edit", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/trace/1/edit", :method => :post },
|
||||||
|
{ :controller => "trace", :action => "edit", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/trace/1/delete", :method => :post },
|
||||||
|
{ :controller => "trace", :action => "delete", :id => "1" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
# Check that the list of changesets is displayed
|
# Check that the list of changesets is displayed
|
||||||
def test_list
|
def test_list
|
||||||
get :list
|
get :list
|
||||||
|
|
58
test/functional/user_blocks_controller_test.rb
Normal file
58
test/functional/user_blocks_controller_test.rb
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
require File.dirname(__FILE__) + '/../test_helper'
|
||||||
|
|
||||||
|
class UserBlocksControllerTest < ActionController::TestCase
|
||||||
|
##
|
||||||
|
# test all routes which lead to this controller
|
||||||
|
def test_routes
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/blocks/new/username", :method => :get },
|
||||||
|
{ :controller => "user_blocks", :action => "new", :display_name => "username" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user_blocks", :method => :get },
|
||||||
|
{ :controller => "user_blocks", :action => "index" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user_blocks/new", :method => :get },
|
||||||
|
{ :controller => "user_blocks", :action => "new" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user_blocks", :method => :post },
|
||||||
|
{ :controller => "user_blocks", :action => "create" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user_blocks/1", :method => :get },
|
||||||
|
{ :controller => "user_blocks", :action => "show", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user_blocks/1/edit", :method => :get },
|
||||||
|
{ :controller => "user_blocks", :action => "edit", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user_blocks/1", :method => :put },
|
||||||
|
{ :controller => "user_blocks", :action => "update", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user_blocks/1", :method => :delete },
|
||||||
|
{ :controller => "user_blocks", :action => "destroy", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/blocks/1/revoke", :method => :get },
|
||||||
|
{ :controller => "user_blocks", :action => "revoke", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/blocks/1/revoke", :method => :post },
|
||||||
|
{ :controller => "user_blocks", :action => "revoke", :id => "1" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/blocks", :method => :get },
|
||||||
|
{ :controller => "user_blocks", :action => "blocks_on", :display_name => "username" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/blocks_by", :method => :get },
|
||||||
|
{ :controller => "user_blocks", :action => "blocks_by", :display_name => "username" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
|
@ -3,6 +3,178 @@ require File.dirname(__FILE__) + '/../test_helper'
|
||||||
class UserControllerTest < ActionController::TestCase
|
class UserControllerTest < ActionController::TestCase
|
||||||
fixtures :users
|
fixtures :users
|
||||||
|
|
||||||
|
##
|
||||||
|
# test all routes which lead to this controller
|
||||||
|
def test_routes
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/user/details", :method => :get },
|
||||||
|
{ :controller => "user", :action => "api_details" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/user/gpx_files", :method => :get },
|
||||||
|
{ :controller => "user", :action => "api_gpx_files" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/login", :method => :get },
|
||||||
|
{ :controller => "user", :action => "login" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/login", :method => :post },
|
||||||
|
{ :controller => "user", :action => "login" }
|
||||||
|
)
|
||||||
|
assert_recognizes(
|
||||||
|
{ :controller => "user", :action => "login", :format => "html" },
|
||||||
|
{ :path => "/login.html", :method => :get }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/logout", :method => :get },
|
||||||
|
{ :controller => "user", :action => "logout" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/logout", :method => :post },
|
||||||
|
{ :controller => "user", :action => "logout" }
|
||||||
|
)
|
||||||
|
assert_recognizes(
|
||||||
|
{ :controller => "user", :action => "logout", :format => "html" },
|
||||||
|
{ :path => "/logout.html", :method => :get }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/new", :method => :get },
|
||||||
|
{ :controller => "user", :action => "new" }
|
||||||
|
)
|
||||||
|
assert_recognizes(
|
||||||
|
{ :controller => "user", :action => "new" },
|
||||||
|
{ :path => "/create-account.html", :method => :get }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/terms", :method => :get },
|
||||||
|
{ :controller => "user", :action => "terms" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/terms", :method => :post },
|
||||||
|
{ :controller => "user", :action => "terms" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/save", :method => :post },
|
||||||
|
{ :controller => "user", :action => "save" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/confirm", :method => :get },
|
||||||
|
{ :controller => "user", :action => "confirm", :display_name => "username" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/confirm", :method => :post },
|
||||||
|
{ :controller => "user", :action => "confirm", :display_name => "username" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/confirm/resend", :method => :get },
|
||||||
|
{ :controller => "user", :action => "confirm_resend", :display_name => "username" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/confirm", :method => :get },
|
||||||
|
{ :controller => "user", :action => "confirm" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/confirm", :method => :post },
|
||||||
|
{ :controller => "user", :action => "confirm" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/confirm-email", :method => :get },
|
||||||
|
{ :controller => "user", :action => "confirm_email" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/confirm-email", :method => :post },
|
||||||
|
{ :controller => "user", :action => "confirm_email" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/go_public", :method => :post },
|
||||||
|
{ :controller => "user", :action => "go_public" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/forgot-password", :method => :get },
|
||||||
|
{ :controller => "user", :action => "lost_password" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/forgot-password", :method => :post },
|
||||||
|
{ :controller => "user", :action => "lost_password" }
|
||||||
|
)
|
||||||
|
assert_recognizes(
|
||||||
|
{ :controller => "user", :action => "lost_password" },
|
||||||
|
{ :path => "/forgot-password.html", :method => :get }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/reset-password", :method => :get },
|
||||||
|
{ :controller => "user", :action => "reset_password" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/reset-password", :method => :post },
|
||||||
|
{ :controller => "user", :action => "reset_password" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/suspended", :method => :get },
|
||||||
|
{ :controller => "user", :action => "suspended" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username", :method => :get },
|
||||||
|
{ :controller => "user", :action => "view", :display_name => "username" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/account", :method => :get },
|
||||||
|
{ :controller => "user", :action => "account", :display_name => "username" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/account", :method => :post },
|
||||||
|
{ :controller => "user", :action => "account", :display_name => "username" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/make_friend", :method => :get },
|
||||||
|
{ :controller => "user", :action => "make_friend", :display_name => "username" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/remove_friend", :method => :get },
|
||||||
|
{ :controller => "user", :action => "remove_friend", :display_name => "username" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/set_status", :method => :get },
|
||||||
|
{ :controller => "user", :action => "set_status", :display_name => "username" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/delete", :method => :get },
|
||||||
|
{ :controller => "user", :action => "delete", :display_name => "username" }
|
||||||
|
)
|
||||||
|
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/users", :method => :get },
|
||||||
|
{ :controller => "user", :action => "list" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/users", :method => :post },
|
||||||
|
{ :controller => "user", :action => "list" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/users/status", :method => :get },
|
||||||
|
{ :controller => "user", :action => "list", :status => "status" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/users/status", :method => :post },
|
||||||
|
{ :controller => "user", :action => "list", :status => "status" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
# The user creation page loads
|
# The user creation page loads
|
||||||
def test_user_create_view
|
def test_user_create_view
|
||||||
get :new
|
get :new
|
||||||
|
|
|
@ -2,7 +2,32 @@ require File.dirname(__FILE__) + '/../test_helper'
|
||||||
|
|
||||||
class UserPreferenceControllerTest < ActionController::TestCase
|
class UserPreferenceControllerTest < ActionController::TestCase
|
||||||
fixtures :users, :user_preferences
|
fixtures :users, :user_preferences
|
||||||
|
|
||||||
|
##
|
||||||
|
# test all routes which lead to this controller
|
||||||
|
def test_routes
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/user/preferences", :method => :get },
|
||||||
|
{ :controller => "user_preference", :action => "read" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/user/preferences", :method => :put },
|
||||||
|
{ :controller => "user_preference", :action => "update" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/user/preferences/key", :method => :get },
|
||||||
|
{ :controller => "user_preference", :action => "read_one", :preference_key => "key" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/user/preferences/key", :method => :put },
|
||||||
|
{ :controller => "user_preference", :action => "update_one", :preference_key => "key" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/user/preferences/key", :method => :delete },
|
||||||
|
{ :controller => "user_preference", :action => "delete_one", :preference_key => "key" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
def test_read
|
def test_read
|
||||||
# first try without auth
|
# first try without auth
|
||||||
get :read
|
get :read
|
||||||
|
@ -21,5 +46,4 @@ class UserPreferenceControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
24
test/functional/user_roles_controller_test.rb
Normal file
24
test/functional/user_roles_controller_test.rb
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
require File.dirname(__FILE__) + '/../test_helper'
|
||||||
|
|
||||||
|
class UserRolesControllerTest < ActionController::TestCase
|
||||||
|
##
|
||||||
|
# test all routes which lead to this controller
|
||||||
|
def test_routes
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/role/rolename/grant", :method => :get },
|
||||||
|
{ :controller => "user_roles", :action => "grant", :display_name => "username", :role => "rolename" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/role/rolename/grant", :method => :post },
|
||||||
|
{ :controller => "user_roles", :action => "grant", :display_name => "username", :role => "rolename" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/role/rolename/revoke", :method => :get },
|
||||||
|
{ :controller => "user_roles", :action => "revoke", :display_name => "username", :role => "rolename" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/user/username/role/rolename/revoke", :method => :post },
|
||||||
|
{ :controller => "user_roles", :action => "revoke", :display_name => "username", :role => "rolename" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
|
@ -4,6 +4,35 @@ require 'way_controller'
|
||||||
class WayControllerTest < ActionController::TestCase
|
class WayControllerTest < ActionController::TestCase
|
||||||
api_fixtures
|
api_fixtures
|
||||||
|
|
||||||
|
##
|
||||||
|
# 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" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/way/1/full", :method => :get },
|
||||||
|
{ :controller => "way", :action => "full", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/way/1", :method => :get },
|
||||||
|
{ :controller => "way", :action => "read", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/way/1", :method => :put },
|
||||||
|
{ :controller => "way", :action => "update", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/way/1", :method => :delete },
|
||||||
|
{ :controller => "way", :action => "delete", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/ways", :method => :get },
|
||||||
|
{ :controller => "way", :action => "ways" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
# Test reading ways.
|
# Test reading ways.
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue