]> git.openstreetmap.org Git - rails.git/commitdiff
Merge branch 'master' into openstreetbugs
authorTom Hughes <tom@compton.nu>
Sat, 10 Mar 2012 15:30:25 +0000 (15:30 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 10 Mar 2012 15:30:25 +0000 (15:30 +0000)
Conflicts:
config/routes.rb
db/structure.sql

66 files changed:
app/controllers/amf_controller.rb
app/controllers/api_controller.rb
app/controllers/trace_controller.rb
app/controllers/user_blocks_controller.rb
app/controllers/user_controller.rb
app/models/spam_observer.rb
app/models/trace_sweeper.rb
app/models/user_sweeper.rb
app/views/layouts/_piwik.html.erb
app/views/message/_message_summary.html.erb
app/views/message/inbox.html.erb
app/views/message/outbox.html.erb
app/views/user/view.html.erb
app/views/user_blocks/_block.html.erb
app/views/user_blocks/edit.html.erb
app/views/user_blocks/revoke.html.erb
config/routes.rb
public/potlatch2/locales/ast.swf
public/potlatch2/locales/br.swf
public/potlatch2/locales/de_DE.swf
public/potlatch2/locales/en_GB.swf
public/potlatch2/locales/en_US.swf
public/potlatch2/locales/es_ES.swf
public/potlatch2/locales/fi.swf
public/potlatch2/locales/fr_FR.swf
public/potlatch2/locales/he.swf
public/potlatch2/locales/hsb.swf
public/potlatch2/locales/ja_JP.swf
public/potlatch2/locales/mk.swf
public/potlatch2/locales/ms.swf
public/potlatch2/locales/nb_NO.swf
public/potlatch2/locales/nl_NL.swf
public/potlatch2/locales/nn_NO.swf
public/potlatch2/locales/pl_PL.swf
public/potlatch2/locales/ru.swf
public/potlatch2/locales/sq.swf
public/potlatch2/locales/tr.swf
public/potlatch2/locales/vi_VN.swf
public/potlatch2/locales/zh_CN.swf
public/potlatch2/potlatch2.swf
test/functional/amf_controller_test.rb
test/functional/api_controller_test.rb
test/functional/browse_controller_test.rb
test/functional/changeset_controller_test.rb
test/functional/diary_entry_controller_test.rb
test/functional/export_controller_test.rb
test/functional/geocoder_controller_test.rb
test/functional/message_controller_test.rb
test/functional/node_controller_test.rb
test/functional/oauth_clients_controller_test.rb [new file with mode: 0644]
test/functional/oauth_controller_test.rb [new file with mode: 0644]
test/functional/old_node_controller_test.rb
test/functional/old_relation_controller_test.rb
test/functional/old_way_controller_test.rb
test/functional/relation_controller_test.rb
test/functional/search_controller_test.rb
test/functional/site_controller_test.rb
test/functional/swf_controller_test.rb
test/functional/trace_controller_test.rb
test/functional/user_blocks_controller_test.rb [new file with mode: 0644]
test/functional/user_controller_test.rb
test/functional/user_preference_controller_test.rb
test/functional/user_roles_controller_test.rb [new file with mode: 0644]
test/functional/way_controller_test.rb
test/integration/user_roles_test.rb
test/integration/user_terms_seen_test.rb

index 139a7a65078058ac2a791161c9797faf72a1e9e8..9f38f0dcddde6d768ab5ed273069cdb5abf99067 100644 (file)
@@ -45,66 +45,58 @@ class AmfController < ApplicationController
   # calls each action (private method) accordingly.
   
   def amf_read
-    if request.post?
-      self.status = :ok
-      self.content_type = Mime::AMF
-      self.response_body = Dispatcher.new(request.raw_post) do |message,*args|
-        logger.info("Executing AMF #{message}(#{args.join(',')})")
-
-        case message
-          when 'getpresets';        result = getpresets(*args)
-          when 'whichways';         result = whichways(*args)
-          when 'whichways_deleted'; result = whichways_deleted(*args)
-          when 'getway';            result = getway(args[0].to_i)
-          when 'getrelation';       result = getrelation(args[0].to_i)
-          when 'getway_old';        result = getway_old(args[0].to_i,args[1])
-          when 'getway_history';    result = getway_history(args[0].to_i)
-          when 'getnode_history';   result = getnode_history(args[0].to_i)
-          when 'findgpx';           result = findgpx(*args)
-          when 'findrelations';     result = findrelations(*args)
-          when 'getpoi';            result = getpoi(*args)
-        end
-        
-        result
+    self.status = :ok
+    self.content_type = Mime::AMF
+    self.response_body = Dispatcher.new(request.raw_post) do |message,*args|
+      logger.info("Executing AMF #{message}(#{args.join(',')})")
+
+      case message
+        when 'getpresets';        result = getpresets(*args)
+        when 'whichways';         result = whichways(*args)
+        when 'whichways_deleted'; result = whichways_deleted(*args)
+        when 'getway';            result = getway(args[0].to_i)
+        when 'getrelation';       result = getrelation(args[0].to_i)
+        when 'getway_old';        result = getway_old(args[0].to_i,args[1])
+        when 'getway_history';    result = getway_history(args[0].to_i)
+        when 'getnode_history';   result = getnode_history(args[0].to_i)
+        when 'findgpx';           result = findgpx(*args)
+        when 'findrelations';     result = findrelations(*args)
+        when 'getpoi';            result = getpoi(*args)
       end
-    else
-      render :nothing => true, :status => :method_not_allowed
+        
+      result
     end
   end
 
   def amf_write
-    if request.post?
-      renumberednodes = {}              # Shared across repeated putways
-      renumberedways = {}               # Shared across repeated putways
-      err = false                       # Abort batch on error
-
-      self.status = :ok
-      self.content_type = Mime::AMF
-      self.response_body = Dispatcher.new(request.raw_post) do |message,*args|
-        logger.info("Executing AMF #{message}")
-
-        if err
-          result = [-5, nil]
-        else
-          case message
-            when 'putway';         orn = renumberednodes.dup
-                                   result = putway(renumberednodes, *args)
-                                   result[4] = renumberednodes.reject { |k,v| orn.has_key?(k) }
-                                   if result[0] == 0 and result[2] != result[3] then renumberedways[result[2]] = result[3] end
-            when 'putrelation';    result = putrelation(renumberednodes, renumberedways, *args)
-            when 'deleteway';      result = deleteway(*args)
-            when 'putpoi';         result = putpoi(*args)
-                                   if result[0] == 0 and result[2] != result[3] then renumberednodes[result[2]] = result[3] end
-            when 'startchangeset'; result = startchangeset(*args)
-          end
+    renumberednodes = {}              # Shared across repeated putways
+    renumberedways = {}               # Shared across repeated putways
+    err = false                       # Abort batch on error
+
+    self.status = :ok
+    self.content_type = Mime::AMF
+    self.response_body = Dispatcher.new(request.raw_post) do |message,*args|
+      logger.info("Executing AMF #{message}")
 
-          err = true if result[0] == -3  # If a conflict is detected, don't execute any more writes
+      if err
+        result = [-5, nil]
+      else
+        case message
+          when 'putway';         orn = renumberednodes.dup
+                                 result = putway(renumberednodes, *args)
+                                 result[4] = renumberednodes.reject { |k,v| orn.has_key?(k) }
+                                 if result[0] == 0 and result[2] != result[3] then renumberedways[result[2]] = result[3] end
+          when 'putrelation';    result = putrelation(renumberednodes, renumberedways, *args)
+          when 'deleteway';      result = deleteway(*args)
+          when 'putpoi';         result = putpoi(*args)
+                                 if result[0] == 0 and result[2] != result[3] then renumberednodes[result[2]] = result[3] end
+          when 'startchangeset'; result = startchangeset(*args)
         end
 
-        result
+        err = true if result[0] == -3  # If a conflict is detected, don't execute any more writes
       end
-    else
-      render :nothing => true, :status => :method_not_allowed
+
+      result
     end
   end
 
index 53e14202c051558090c820d91f17f6169d89d4bc..002bd73b881fef24dfe07acbd40581a161665ff9 100644 (file)
@@ -68,7 +68,7 @@ class ApiController < ApplicationController
           if gpx_file.identifiable?
             track << (XML::Node.new("name") << gpx_file.name)
             track << (XML::Node.new("desc") << gpx_file.description)
-            track << (XML::Node.new("url") << url_for(:controller => 'trace', :action => 'view', :id => gpx_file.id))
+            track << (XML::Node.new("url") << url_for(:controller => 'trace', :action => 'view', :display_name => gpx_file.user.display_name, :id => gpx_file.id))
           end
         else
           # use the anonymous track segment if the user hasn't allowed
index e3f41f0ace69ef5148804aef75cbf17cb1004819..7b2314be33c9db4b91906ececf8d5745768f128b 100644 (file)
@@ -187,7 +187,7 @@ class TraceController < ApplicationController
         @trace.tagstring = params[:trace][:tagstring]
         @trace.visibility = params[:trace][:visibility]
         if @trace.save
-          redirect_to :action => 'view'
+          redirect_to :action => 'view', :display_name => @user.display_name
         end
       end
     else
@@ -201,13 +201,13 @@ class TraceController < ApplicationController
     trace = Trace.find(params[:id])
 
     if @user and trace.user == @user
-      if request.post? and trace.visible?
+      if trace.visible?
         trace.visible = false
         trace.save
         flash[:notice] = t 'trace.delete.scheduled_for_deletion'
         redirect_to :action => :list, :display_name => @user.display_name
       else
-        render :nothing => true, :status => :bad_request
+        render :nothing => true, :status => :not_found
       end
     else
       render :nothing => true, :status => :forbidden
@@ -333,34 +333,30 @@ class TraceController < ApplicationController
   end
 
   def api_create
-    if request.post?
-      tags = params[:tags] || ""
-      description = params[:description] || ""
-      visibility = params[:visibility]
-
-      if visibility.nil?
-        if params[:public] && params[:public].to_i.nonzero?
-          visibility = "public"
-        else
-          visibility = "private"
-        end
+    tags = params[:tags] || ""
+    description = params[:description] || ""
+    visibility = params[:visibility]
+
+    if visibility.nil?
+      if params[:public] && params[:public].to_i.nonzero?
+        visibility = "public"
+      else
+        visibility = "private"
       end
+    end
 
-      if params[:file].respond_to?(:read)
-        do_create(params[:file], tags, description, visibility)
+    if params[:file].respond_to?(:read)
+      do_create(params[:file], tags, description, visibility)
 
-        if @trace.id
-          render :text => @trace.id.to_s, :content_type => "text/plain"
-        elsif @trace.valid?
-          render :nothing => true, :status => :internal_server_error
-        else
-          render :nothing => true, :status => :bad_request
-        end
+      if @trace.id
+        render :text => @trace.id.to_s, :content_type => "text/plain"
+      elsif @trace.valid?
+        render :nothing => true, :status => :internal_server_error
       else
         render :nothing => true, :status => :bad_request
       end
     else
-      render :nothing => true, :status => :method_not_allowed
+      render :nothing => true, :status => :bad_request
     end
   end
 
index 75c9df9dc90be24f13f1ebee83f895bd94d80e4f..2bdafa80e482aace89ced8123091255fb82fc9c1 100644 (file)
@@ -39,11 +39,13 @@ class UserBlocksController < ApplicationController
       return
     end
 
-    @user_block = UserBlock.new(:user_id => @this_user.id,
-                                :creator_id => @user.id,
-                                :reason => params[:user_block][:reason],
-                                :ends_at => Time.now.getutc() + @block_period.hours,
-                                :needs_view => params[:user_block][:needs_view])
+    @user_block = UserBlock.new({
+      :user_id => @this_user.id,
+      :creator_id => @user.id,
+      :reason => params[:user_block][:reason],
+      :ends_at => Time.now.getutc() + @block_period.hours,
+      :needs_view => params[:user_block][:needs_view]
+    }, :without_protection => true)
     
     if @user_block.save
       flash[:notice] = t('user_block.create.flash', :name => @this_user.display_name)
@@ -67,7 +69,7 @@ class UserBlocksController < ApplicationController
       
     if @user_block.update_attributes({ :ends_at => Time.now.getutc() + @block_period.hours,
                                        :reason => params[:user_block][:reason],
-                                       :needs_view => params[:user_block][:needs_view] })
+                                       :needs_view => params[:user_block][:needs_view] }, :without_protection => true)
       flash[:notice] = t('user_block.update.success')
       redirect_to(@user_block)
     else
index a591906976b93863760e8d80070a7fab79c9817c..0aeab63b37f10db726a2a67d5f4a4620c96c9c0b 100644 (file)
@@ -473,7 +473,8 @@ class UserController < ApplicationController
   ##
   # sets a user's status
   def set_status
-    @this_user.update_attributes(:status => params[:status])
+    @this_user.status = params[:status]
+    @this_user.save
     redirect_to :controller => 'user', :action => 'view', :display_name => params[:display_name]
   end
 
@@ -717,7 +718,7 @@ private
   # Choose the layout to use. See
   # https://rails.lighthouseapp.com/projects/8994/tickets/5371-layout-with-onlyexcept-options-makes-other-actions-render-without-layouts
   def choose_layout
-    oauth_url = url_for(:controller => :oauth, :action => :oauthorize, :only_path => true)
+    oauth_url = url_for(:controller => :oauth, :action => :authorize, :only_path => true)
 
     if [ 'api_details' ].include? action_name
       nil
index 888b4a0b9cb6719624a509a343dc21fc717857f4..07fa84ffd07c6975d0043c71b086d62cbbda2fc2 100644 (file)
@@ -9,7 +9,7 @@ class SpamObserver < ActiveRecord::Observer
     end
 
     if user.status == "active" and user.spam_score > SPAM_THRESHOLD
-      user.update_attributes(:status => "suspended")
+      user.update_column(:status, "suspended")
     end
   end
 end
index 52780f9e4d2de54b68f9d0804f646cc059ae04f0..777a58a55250d53df4c16290e01ba305c1da9ed0 100644 (file)
@@ -16,7 +16,6 @@ class TraceSweeper < ActionController::Caching::Sweeper
 private
 
   def expire_cache_for(record)
-    expire_action(:controller => 'trace', :action => 'view', :id => record.id)
     expire_action(:controller => 'trace', :action => 'view', :display_name => record.user.display_name, :id => record.id)
 
     expire_action(:controller => 'trace', :action => 'list', :display_name => nil, :tag => nil)
index a58b93832e74cf3558047cb5c5777df9e780c82b..8ce48e5b34d6032e5332bba954fe75695f528259 100644 (file)
@@ -34,7 +34,6 @@ private
       expire_action(:controller => 'diary_entry', :action => 'rss', :format => :rss, :language => nil, :display_name => old_record.display_name)
 
       old_record.traces.each do |trace|
-        expire_action(:controller => 'trace', :action => 'view', :id => trace.id)
         expire_action(:controller => 'trace', :action => 'view', :display_name => old_record.display_name, :id => trace.id)
 
         trace.tags.each do |tag|
index 0b719932d1caf004123e73db3f53a505e3d54d84..0ba307437c53393fc5ecc04110014314a199b142 100644 (file)
@@ -1,15 +1,14 @@
-<!-- Piwik -->
 <script type="text/javascript">
-var pkBaseURL = (("https:" == document.location.protocol) ? "https://<%= PIWIK_LOCATION %>/" : "http://<%= PIWIK_LOCATION %>/");
-document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
-</script><script type="text/javascript">
-try {
-var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", <%= PIWIK_SITE %>);
-piwikTracker.trackPageView();
-piwikTracker.enableLinkTracking();
+var _paq = _paq || [];
+(function(){ var u="<%= request.protocol %><%= PIWIK_LOCATION %>/";
+_paq.push(['setSiteId', <%= PIWIK_SITE %>]);
+_paq.push(['setTrackerUrl', u+'piwik.php']);
+_paq.push(['trackPageView']);
+_paq.push(['enableLinkTracking']);
 <% if flash[:piwik_goal] -%>
-piwikTracker.trackGoal(<%= flash[:piwik_goal] %>);
+_paq.push(['setSiteId', <%= flash[:piwik_goal] %>);
 <% end -%>
-} catch( err ) {}
-</script><noscript><p><img src="http://<%= PIWIK_LOCATION %>/piwik.php?idsite=<%= PIWIK_SITE %>" style="border:0" alt="" /></p></noscript>
-<!-- End Piwik Tracking Code -->
+var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.defer=true; g.async=true; g.src=u+'piwik.js';
+s.parentNode.insertBefore(g,s); })();
+</script>
+<noscript><p><img src="<%= request.protocol %><%= PIWIK_LOCATION %>/piwik.php?idsite=<%= PIWIK_SITE %>" style="border:0" alt="" /></p></noscript>
index 70fd4403505c75a2b474b458adb0d88e13015873..82d528a0400ddd643327c6c8703f6c5ddcb205cc 100644 (file)
@@ -1,7 +1,7 @@
 <% this_colour = cycle('lightgrey', 'white') %>
 
 <tr id="inbox-<%= message_summary.id %>" class="inbox-row<%= "-unread" if not message_summary.message_read? %>">
-  <td class="inbox-sender" bgcolor="<%= this_colour %>"><%= link_to h(message_summary.sender.display_name), :controller => 'user', :action => message_summary.sender.display_name %></td>
+  <td class="inbox-sender" bgcolor="<%= this_colour %>"><%= link_to h(message_summary.sender.display_name), :controller => 'user', :action => 'view', :display_name => message_summary.sender.display_name %></td>
   <td class="inbox-subject" bgcolor="<%= this_colour %>"><%= link_to h(message_summary.title), :controller => 'message', :action => 'read', :message_id => message_summary.id  %></td>
   <td class="inbox-sent nowrap" bgcolor="<%= this_colour %>"><%= l message_summary.sent_on, :format => :friendly %></td>
   <% if message_summary.message_read? %>
index bcd2da33a14abcf7bb560c6996ede6244de10fff..0cbc7c77c4748365b9b06075c2e4daf6668ed6ff 100644 (file)
@@ -1,4 +1,4 @@
-<h2><%= t'message.inbox.my_inbox'%>/<%= link_to t('message.inbox.outbox'), url_for(:controller => "user", :action => "outbox", :id => @user.display_name) %></h2>
+<h2><%= t'message.inbox.my_inbox'%>/<%= link_to t('message.inbox.outbox'), outbox_path(@user.display_name) %></h2>
 
 <%= render :partial => "message_count" %>
 
index fd89581262a323b2f851cf53d6be3c3c6f4f956b..ece51428975c881bf090f6af83c69dbc042f784a 100644 (file)
@@ -1,4 +1,4 @@
-<h2><%= raw(t'message.outbox.my_inbox', :inbox_link => link_to(t('message.outbox.inbox'), url_for(:controller => "user", :action => "inbox", :id => @user.display_name))) %>/<%= t'message.outbox.outbox' %></h2>
+<h2><%= raw(t'message.outbox.my_inbox', :inbox_link => link_to(t('message.outbox.inbox'), inbox_path(@user.display_name))) %>/<%= t'message.outbox.outbox' %></h2>
 
 <p><%= t'message.outbox.messages', :count => @user.sent_messages.size %>
 
index edf290c7b7c7ba143ce634b0ac082e5e449d5e0e..834a8528f0c63683edbfd18e499b9d269620e55e 100644 (file)
@@ -19,7 +19,7 @@
     <!-- Displaying user's own profile page -->
     <%= link_to t('user.view.my diary'), :controller => 'diary_entry', :action => 'list', :display_name => @user.display_name %>
     |
-    <%= link_to t('user.view.new diary entry'), :controller => 'diary_entry', :action => 'new', :display_name => @user.display_name %>
+    <%= link_to t('user.view.new diary entry'), :controller => 'diary_entry', :action => 'new' %>
     |
     <%= link_to t('user.view.my comments' ), :controller => 'diary_entry', :action => 'comments', :display_name => @this_user.display_name %>
     |
   <% if friends.empty? %>
     <%= t 'user.view.no friends' %>
   <% else %>
-    <%= link_to t('user.view.friends_changesets'), {:controller => 'browse', :action => 'friends'} %><br/>
-    <%= link_to t('user.view.friends_diaries'), {:controller => 'diary', :action => 'friends'} %><br/><br/>
+    <%= link_to t('user.view.friends_changesets'), friend_changesets_path %><br/>
+    <%= link_to t('user.view.friends_diaries'), friend_diaries_path %><br/><br/>
     <table id="friends">
       <%= render :partial => "contact", :collection => friends %>
     </table>
   <% if nearby.empty? %>
     <%= t 'user.view.no nearby users' %>
   <% else %>
-    <%= link_to t('user.view.nearby_changesets'), {:controller => 'browse', :action => 'nearby'} %><br/>
-    <%= link_to t('user.view.nearby_diaries'), {:controller => 'diary', :action => 'nearby'} %><br/><br/>
+    <%= link_to t('user.view.nearby_changesets'), nearby_changesets_path %><br/>
+    <%= link_to t('user.view.nearby_diaries'), nearby_diaries_path %><br/><br/>
     <table id="nearbyusers">
       <%= render :partial => "contact", :collection => nearby %>
     </table>
index 0e2b3a287bcd006f94efaf6b1ba3781c89b59f1d..362cfd107bcf9b5c371629515958e6c239e16902 100644 (file)
@@ -19,6 +19,6 @@
   <td class="<%= c1 %>"><%= link_to t('user_block.partial.show'), block %></td>
   <td class="<%= c1 %>"><% if @user and @user.id == block.creator_id and block.active? %><%= link_to t('user_block.partial.edit'), edit_user_block_path(block) %><% end %></td>
   <% if show_revoke_link %>
-  <td class="<%= c1 %>"><% if block.active? %><%= link_to t('user_block.partial.revoke'), block, :confirm => t('user_block.partial.confirm'), :action => :revoke %><% end %></td>
+  <td class="<%= c1 %>"><% if block.active? %><%= link_to t('user_block.partial.revoke'), :controller => 'user_blocks', :action => 'revoke', :id => block.id %><% end %></td>
   <% end %>
 </tr>
index 777022dab8cf416541e57cc95f03d7930b34d009..a50ac75d7616c6ddb9c693cdbb6a65d90cf2f6e8 100644 (file)
@@ -1,8 +1,8 @@
 <% @title = t 'user_block.edit.title', :name => h(@user_block.user.display_name) %>
-<h1><%= t('user_block.edit.title',
-          :name => link_to(
-                           h(@user_block.user.display_name),
-                           {:controller => 'user', :action => 'view', :display_name => @user_block.user.display_name})) %></h1>
+<h1><%= raw t('user_block.edit.title',
+              :name => link_to(
+                               h(@user_block.user.display_name),
+                               {:controller => 'user', :action => 'view', :display_name => @user_block.user.display_name})) %></h1>
 
 <%= form_for(@user_block) do |f| %>
   <%= f.error_messages %>
index 0819357d393693ba8ab669ec8df815f294de8cf2..28ae01930f6a674a0197dc8e3c2ce8095fb38a04 100644 (file)
@@ -1,13 +1,13 @@
 <% @title = t('user_block.revoke.title',
               :block_on => h(@user_block.user.display_name),
               :block_by => h(@user_block.creator.display_name)) %>
-<h1><%= t('user_block.revoke.heading',
-          :block_on => link_to(
-                               h(@user_block.user.display_name),
-                               {:controller => 'user', :action => 'view', :display_name => @user_block.user.display_name}),
-          :block_by => link_to(
-                               h(@user_block.creator.display_name),
-                               {:controller => 'user', :action => 'view', :display_name => @user_block.creator.display_name})) %></h1>
+<h1><%= raw t('user_block.revoke.heading',
+              :block_on => link_to(
+                                   h(@user_block.user.display_name),
+                                   {:controller => 'user', :action => 'view', :display_name => @user_block.user.display_name}),
+              :block_by => link_to(
+                                   h(@user_block.creator.display_name),
+                                   {:controller => 'user', :action => 'view', :display_name => @user_block.creator.display_name})) %></h1>
 
 <% if @user_block.ends_at > Time.now %>
 <p><b>
index 0c090ef3c997efdc8927d293475243dc900ad9db..e466fc3627d807d5635256c0de2b4f86efbc7faa 100644 (file)
@@ -1,78 +1,77 @@
 OpenStreetMap::Application.routes.draw do
   # API
-  match 'api/capabilities' => 'api#capabilities'
-  match 'api/0.6/capabilities' => 'api#capabilities'
-
-  match 'api/0.6/changeset/create' => 'changeset#create'
-  match 'api/0.6/changeset/:id/upload' => 'changeset#upload', :id => /\d+/
-  match 'api/0.6/changeset/:id/download' => 'changeset#download', :as => :changeset_download, :id => /\d+/
-  match 'api/0.6/changeset/:id/expand_bbox' => 'changeset#expand_bbox', :id => /\d+/
-  match 'api/0.6/changeset/:id' => 'changeset#read', :as => :changeset_read, :via => :get, :id => /\d+/
+  match 'api/capabilities' => 'api#capabilities', :via => :get
+  match 'api/0.6/capabilities' => 'api#capabilities', :via => :get
+
+  match 'api/0.6/changeset/create' => 'changeset#create', :via => :put
+  match 'api/0.6/changeset/:id/upload' => 'changeset#upload', :via => :post, :id => /\d+/
+  match 'api/0.6/changeset/:id/download' => 'changeset#download', :via => :get, :as => :changeset_download, :id => /\d+/
+  match 'api/0.6/changeset/:id/expand_bbox' => 'changeset#expand_bbox', :via => :post, :id => /\d+/
+  match 'api/0.6/changeset/:id' => 'changeset#read', :via => :get, :as => :changeset_read, :via => :get, :id => /\d+/
   match 'api/0.6/changeset/:id' => 'changeset#update', :via => :put, :id => /\d+/
-  match 'api/0.6/changeset/:id/close' => 'changeset#close', :id => /\d+/
-  match 'api/0.6/changesets' => 'changeset#query', :id => nil
-
-  match 'api/0.6/node/create' => 'node#create'
-  match 'api/0.6/node/:id/ways' => 'way#ways_for_node', :id => /\d+/
-  match 'api/0.6/node/:id/relations' => 'relation#relations_for_node', :id => /\d+/
-  match 'api/0.6/node/:id/history' => 'old_node#history', :id => /\d+/
-  match 'api/0.6/node/:id/:version' => 'old_node#version', :version => /\d+/, :id => /\d+/
+  match 'api/0.6/changeset/:id/close' => 'changeset#close', :via => :put, :id => /\d+/
+  match 'api/0.6/changesets' => 'changeset#query', :via => :get
+
+  match 'api/0.6/node/create' => 'node#create', :via => :put
+  match 'api/0.6/node/:id/ways' => 'way#ways_for_node', :via => :get, :id => /\d+/
+  match 'api/0.6/node/:id/relations' => 'relation#relations_for_node', :via => :get, :id => /\d+/
+  match 'api/0.6/node/:id/history' => 'old_node#history', :via => :get, :id => /\d+/
+  match 'api/0.6/node/:id/:version' => 'old_node#version', :via => :get, :id => /\d+/, :version => /\d+/
   match 'api/0.6/node/:id' => 'node#read', :via => :get, :id => /\d+/
   match 'api/0.6/node/:id' => 'node#update', :via => :put, :id => /\d+/
   match 'api/0.6/node/:id' => 'node#delete', :via => :delete, :id => /\d+/
-  match 'api/0.6/nodes' => 'node#nodes', :id => nil
+  match 'api/0.6/nodes' => 'node#nodes', :via => :get
 
-  match 'api/0.6/way/create' => 'way#create'
-  match 'api/0.6/way/:id/history' => 'old_way#history', :id => /\d+/
-  match 'api/0.6/way/:id/full' => 'way#full', :id => /\d+/
-  match 'api/0.6/way/:id/relations' => 'relation#relations_for_way', :id => /\d+/
-  match 'api/0.6/way/:id/:version' => 'old_way#version', :version => /\d+/, :id => /\d+/
+  match 'api/0.6/way/create' => 'way#create', :via => :put
+  match 'api/0.6/way/:id/history' => 'old_way#history', :via => :get, :id => /\d+/
+  match 'api/0.6/way/:id/full' => 'way#full', :via => :get, :id => /\d+/
+  match 'api/0.6/way/:id/relations' => 'relation#relations_for_way', :via => :get, :id => /\d+/
+  match 'api/0.6/way/:id/:version' => 'old_way#version', :via => :get, :id => /\d+/, :version => /\d+/
   match 'api/0.6/way/:id' => 'way#read', :via => :get, :id => /\d+/
   match 'api/0.6/way/:id' => 'way#update', :via => :put, :id => /\d+/
   match 'api/0.6/way/:id' => 'way#delete', :via => :delete, :id => /\d+/
-  match 'api/0.6/ways' => 'way#ways', :id => nil
+  match 'api/0.6/ways' => 'way#ways', :via => :get
 
-  match 'api/0.6/relation/create' => 'relation#create'
-  match 'api/0.6/relation/:id/relations' => 'relation#relations_for_relation', :id => /\d+/
-  match 'api/0.6/relation/:id/history' => 'old_relation#history', :id => /\d+/
-  match 'api/0.6/relation/:id/full' => 'relation#full', :id => /\d+/
-  match 'api/0.6/relation/:id/:version' => 'old_relation#version', :version => /\d+/, :id => /\d+/
+  match 'api/0.6/relation/create' => 'relation#create', :via => :put
+  match 'api/0.6/relation/:id/relations' => 'relation#relations_for_relation', :via => :get, :id => /\d+/
+  match 'api/0.6/relation/:id/history' => 'old_relation#history', :via => :get, :id => /\d+/
+  match 'api/0.6/relation/:id/full' => 'relation#full', :via => :get, :id => /\d+/
+  match 'api/0.6/relation/:id/:version' => 'old_relation#version', :via => :get, :id => /\d+/, :version => /\d+/
   match 'api/0.6/relation/:id' => 'relation#read', :via => :get, :id => /\d+/
   match 'api/0.6/relation/:id' => 'relation#update', :via => :put, :id => /\d+/
   match 'api/0.6/relation/:id' => 'relation#delete', :via => :delete, :id => /\d+/
-  match 'api/0.6/relations' => 'relation#relations'
+  match 'api/0.6/relations' => 'relation#relations', :via => :get
 
-  match 'api/0.6/map' => 'api#map'
+  match 'api/0.6/map' => 'api#map', :via => :get
 
-  match 'api/0.6/trackpoints' => 'api#trackpoints'
+  match 'api/0.6/trackpoints' => 'api#trackpoints', :via => :get
 
-  match 'api/0.6/changes' => 'api#changes'
+  match 'api/0.6/changes' => 'api#changes', :via => :get
 
-  match 'api/0.6/search' => 'search#search_all'
-  match 'api/0.6/ways/search' => 'search#search_ways'
-  match 'api/0.6/relations/search' => 'search#search_relations'
-  match 'api/0.6/nodes/search' => 'search#search_nodes'
+  match 'api/0.6/search' => 'search#search_all', :via => :get
+  match 'api/0.6/ways/search' => 'search#search_ways', :via => :get
+  match 'api/0.6/relations/search' => 'search#search_relations', :via => :get
+  match 'api/0.6/nodes/search' => 'search#search_nodes', :via => :get
 
-  match 'api/0.6/user/details' => 'user#api_details'
+  match 'api/0.6/user/details' => 'user#api_details', :via => :get
   match 'api/0.6/user/preferences' => 'user_preference#read', :via => :get
   match 'api/0.6/user/preferences/:preference_key' => 'user_preference#read_one', :via => :get
   match 'api/0.6/user/preferences' => 'user_preference#update', :via => :put
   match 'api/0.6/user/preferences/:preference_key' => 'user_preference#update_one', :via => :put
   match 'api/0.6/user/preferences/:preference_key' => 'user_preference#delete_one', :via => :delete
-  match 'api/0.6/user/gpx_files' => 'user#api_gpx_files'
+  match 'api/0.6/user/gpx_files' => 'user#api_gpx_files', :via => :get
 
-  match 'api/0.6/gpx/create' => 'trace#api_create'
+  match 'api/0.6/gpx/create' => 'trace#api_create', :via => :post
   match 'api/0.6/gpx/:id' => 'trace#api_read', :via => :get, :id => /\d+/
   match 'api/0.6/gpx/:id' => 'trace#api_update', :via => :put, :id => /\d+/
   match 'api/0.6/gpx/:id' => 'trace#api_delete', :via => :delete, :id => /\d+/
-  match 'api/0.6/gpx/:id/details' => 'trace#api_read', :id => /\d+/
-  match 'api/0.6/gpx/:id/data' => 'trace#api_data'
-  match 'api/0.6/gpx/:id/data.:format' => 'trace#api_data'
+  match 'api/0.6/gpx/:id/details' => 'trace#api_read', :via => :get, :id => /\d+/
+  match 'api/0.6/gpx/:id/data' => 'trace#api_data', :via => :get
   
   # AMF (ActionScript) API
-  match 'api/0.6/amf/read' => 'amf#amf_read'
-  match 'api/0.6/amf/write' => 'amf#amf_write'
-  match 'api/0.6/swf/trackpoints' => 'swf#trackpoints'
+  match 'api/0.6/amf/read' => 'amf#amf_read', :via => :post
+  match 'api/0.6/amf/write' => 'amf#amf_write', :via => :post
+  match 'api/0.6/swf/trackpoints' => 'swf#trackpoints', :via => :get
 
   # Map notes API
   match 'api/0.6/notes' => 'note#list', :format => :xml
@@ -90,145 +89,136 @@ OpenStreetMap::Application.routes.draw do
   match 'api/0.6/notes/getRSSfeed' => 'note#rss', :format => :rss
 
   # Data browsing
-  match '/browse/start' => 'browse#start'
-  match '/browse/way/:id' => 'browse#way', :id => /\d+/
-  match '/browse/way/:id/history' => 'browse#way_history', :id => /\d+/
-  match '/browse/node/:id' => 'browse#node', :id => /\d+/
-  match '/browse/node/:id/history' => 'browse#node_history', :id => /\d+/
-  match '/browse/relation/:id' => 'browse#relation', :id => /\d+/
-  match '/browse/relation/:id/history' => 'browse#relation_history', :id => /\d+/
-  match '/browse/changeset/:id' => 'browse#changeset', :as => :changeset, :id => /\d+/
-  match '/user/:display_name/edits' => 'changeset#list'
-  match '/user/:display_name/edits/feed' => 'changeset#feed', :format => :atom
-  match '/browse/friends' => 'changeset#list', :friends => true
-  match '/browse/nearby' => 'changeset#list', :nearby => true
-  match '/browse/changesets' => 'changeset#list'
-  match '/browse/changesets/feed' => 'changeset#feed', :format => :atom
-  match '/browse/note/:id' => 'browse#note', :id => /\d+/
-  match '/user/:display_name/notes' => 'note#mine'
-  match '/browse' => 'changeset#list'
+  match '/browse/start' => 'browse#start', :via => :get
+  match '/browse/way/:id' => 'browse#way', :via => :get, :id => /\d+/
+  match '/browse/way/:id/history' => 'browse#way_history', :via => :get, :id => /\d+/
+  match '/browse/node/:id' => 'browse#node', :via => :get, :id => /\d+/
+  match '/browse/node/:id/history' => 'browse#node_history', :via => :get, :id => /\d+/
+  match '/browse/relation/:id' => 'browse#relation', :via => :get, :id => /\d+/
+  match '/browse/relation/:id/history' => 'browse#relation_history', :via => :get, :id => /\d+/
+  match '/browse/changeset/:id' => 'browse#changeset', :via => :get, :as => :changeset, :id => /\d+/
+  match '/browse/note/:id' => 'browse#note', :via => :get, :id => /\d+/
+  match '/user/:display_name/edits' => 'changeset#list', :via => :get
+  match '/user/:display_name/edits/feed' => 'changeset#feed', :via => :get, :format => :atom
+  match '/user/:display_name/notes' => 'note#mine', :via => :get
+  match '/browse/friends' => 'changeset#list', :via => :get, :friends => true, :as => "friend_changesets"
+  match '/browse/nearby' => 'changeset#list', :via => :get, :nearby => true, :as => "nearby_changesets"
+  match '/browse/changesets' => 'changeset#list', :via => :get
+  match '/browse/changesets/feed' => 'changeset#feed', :via => :get, :format => :atom
+  match '/browse' => 'changeset#list', :via => :get
 
   # web site
-  root :to => 'site#index'
-  match '/edit' => 'site#edit'
-  match '/copyright/:copyright_locale' => 'site#copyright'
-  match '/copyright' => 'site#copyright'
-  match '/history' => 'changeset#list'
-  match '/history/feed' => 'changeset#feed', :format => :atom
-  match '/export' => 'site#export'
-  match '/login' => 'user#login'
-  match '/logout' => 'user#logout'
-  match '/offline' => 'site#offline'
-  match '/key' => 'site#key'
-  match '/user/new' => 'user#new'
-  match '/user/terms' => 'user#terms'
-  match '/user/save' => 'user#save'
-  match '/user/:display_name/confirm/resend' => 'user#confirm_resend'
-  match '/user/:display_name/confirm' => 'user#confirm'
-  match '/user/confirm' => 'user#confirm'
-  match '/user/confirm-email' => 'user#confirm_email'
-  match '/user/go_public' => 'user#go_public'
-  match '/user/reset-password' => 'user#reset_password'
-  match '/user/forgot-password' => 'user#lost_password'
-  match '/user/suspended' => 'user#suspended'
-
-  match '/index.html' => 'site#index'
-  match '/edit.html' => 'site#edit'
-  match '/export.html' => 'site#export'
-  match '/login.html' => 'user#login'
-  match '/logout.html' => 'user#logout'
-  match '/create-account.html' => 'user#new'
-  match '/forgot-password.html' => 'user#lost_password'
+  root :to => 'site#index', :via => :get
+  match '/edit' => 'site#edit', :via => :get
+  match '/copyright/:copyright_locale' => 'site#copyright', :via => :get
+  match '/copyright' => 'site#copyright', :via => :get
+  match '/history' => 'changeset#list', :via => :get
+  match '/history/feed' => 'changeset#feed', :via => :get, :format => :atom
+  match '/export' => 'site#export', :via => :get
+  match '/login' => 'user#login', :via => [:get, :post]
+  match '/logout' => 'user#logout', :via => [:get, :post]
+  match '/offline' => 'site#offline', :via => :get
+  match '/key' => 'site#key', :via => :post
+  match '/user/new' => 'user#new', :via => :get
+  match '/user/terms' => 'user#terms', :via => [:get, :post]
+  match '/user/save' => 'user#save', :via => :post
+  match '/user/:display_name/confirm/resend' => 'user#confirm_resend', :via => :get
+  match '/user/:display_name/confirm' => 'user#confirm', :via => [:get, :post]
+  match '/user/confirm' => 'user#confirm', :via => [:get, :post]
+  match '/user/confirm-email' => 'user#confirm_email', :via => [:get, :post]
+  match '/user/go_public' => 'user#go_public', :via => :post
+  match '/user/reset-password' => 'user#reset_password', :via => [:get, :post]
+  match '/user/forgot-password' => 'user#lost_password', :via => [:get, :post]
+  match '/user/suspended' => 'user#suspended', :via => :get
+
+  match '/index.html' => 'site#index', :via => :get
+  match '/create-account.html' => 'user#new', :via => :get
+  match '/forgot-password.html' => 'user#lost_password', :via => :get
 
   # permalink
-  match '/go/:code' => 'site#permalink', :code => /[a-zA-Z0-9_@~]+[=-]*/
+  match '/go/:code' => 'site#permalink', :via => :get, :code => /[a-zA-Z0-9_@~]+[=-]*/
 
   # traces
-  match '/user/:display_name/traces/tag/:tag/page/:page' => 'trace#list'
-  match '/user/:display_name/traces/tag/:tag' => 'trace#list'
-  match '/user/:display_name/traces/page/:page' => 'trace#list'
-  match '/user/:display_name/traces' => 'trace#list'
-  match '/user/:display_name/traces/tag/:tag/rss' => 'trace#georss'
-  match '/user/:display_name/traces/rss' => 'trace#georss'
-  match '/user/:display_name/traces/:id' => 'trace#view'
-  match '/user/:display_name/traces/:id/picture' => 'trace#picture'
-  match '/user/:display_name/traces/:id/icon' => 'trace#icon'
-  match '/traces/tag/:tag/page/:page' => 'trace#list'
-  match '/traces/tag/:tag' => 'trace#list'
-  match '/traces/page/:page' => 'trace#list'
-  match '/traces' => 'trace#list'
-  match '/traces/tag/:tag/rss' => 'trace#georss'
-  match '/traces/rss' => 'trace#georss'
-  match '/traces/mine/tag/:tag/page/:page' => 'trace#mine'
-  match '/traces/mine/tag/:tag' => 'trace#mine'
-  match '/traces/mine/page/:page' => 'trace#mine'
-  match '/traces/mine' => 'trace#mine'
-  match '/trace/create' => 'trace#create'
-  match '/trace/:id/data' => 'trace#data'
-  match '/trace/:id/data.:format' => 'trace#data'
-  match '/trace/:id/edit' => 'trace#edit'
-  match '/trace/:id/delete' => 'trace#delete'
+  match '/user/:display_name/traces/tag/:tag/page/:page' => 'trace#list', :via => :get
+  match '/user/:display_name/traces/tag/:tag' => 'trace#list', :via => :get
+  match '/user/:display_name/traces/page/:page' => 'trace#list', :via => :get
+  match '/user/:display_name/traces' => 'trace#list', :via => :get
+  match '/user/:display_name/traces/tag/:tag/rss' => 'trace#georss', :via => :get
+  match '/user/:display_name/traces/rss' => 'trace#georss', :via => :get
+  match '/user/:display_name/traces/:id' => 'trace#view', :via => :get
+  match '/user/:display_name/traces/:id/picture' => 'trace#picture', :via => :get
+  match '/user/:display_name/traces/:id/icon' => 'trace#icon', :via => :get
+  match '/traces/tag/:tag/page/:page' => 'trace#list', :via => :get
+  match '/traces/tag/:tag' => 'trace#list', :via => :get
+  match '/traces/page/:page' => 'trace#list', :via => :get
+  match '/traces' => 'trace#list', :via => :get
+  match '/traces/tag/:tag/rss' => 'trace#georss', :via => :get
+  match '/traces/rss' => 'trace#georss', :via => :get
+  match '/traces/mine/tag/:tag/page/:page' => 'trace#mine', :via => :get
+  match '/traces/mine/tag/:tag' => 'trace#mine', :via => :get
+  match '/traces/mine/page/:page' => 'trace#mine', :via => :get
+  match '/traces/mine' => 'trace#mine', :via => :get
+  match '/trace/create' => 'trace#create', :via => [:get, :post]
+  match '/trace/:id/data' => 'trace#data', :via => :get
+  match '/trace/:id/edit' => 'trace#edit', :via => [:get, :post, :put]
+  match '/trace/:id/delete' => 'trace#delete', :via => :post
 
   # diary pages
-  match '/diary/new' => 'diary_entry#new'
-  match '/diary/friends' => 'diary_entry#list', :friends => true
-  match '/diary/nearby' => 'diary_entry#list', :nearby => true  
-  match '/user/:display_name/diary/rss' => 'diary_entry#rss', :format => :rss
-  match '/diary/:language/rss' => 'diary_entry#rss', :format => :rss
-  match '/diary/rss' => 'diary_entry#rss', :format => :rss
-  match '/user/:display_name/diary/comments/:page' => 'diary_entry#comments', :page => /\d+/
-  match '/user/:display_name/diary/comments/' => 'diary_entry#comments'
-  match '/user/:display_name/diary' => 'diary_entry#list'
-  match '/diary/:language' => 'diary_entry#list'
-  match '/diary' => 'diary_entry#list'
-  match '/user/:display_name/diary/:id' => 'diary_entry#view', :id => /\d+/
-  match '/user/:display_name/diary/:id/newcomment' => 'diary_entry#comment', :id => /\d+/
-  match '/user/:display_name/diary/:id/edit' => 'diary_entry#edit', :id => /\d+/
-  match '/user/:display_name/diary/:id/hide' => 'diary_entry#hide', :id => /\d+/
-  match '/user/:display_name/diary/:id/hidecomment/:comment' => 'diary_entry#hidecomment', :id => /\d+/, :comment => /\d+/
+  match '/diary/new' => 'diary_entry#new', :via => [:get, :post]
+  match '/diary/friends' => 'diary_entry#list', :friends => true, :via => :get, :as => "friend_diaries"
+  match '/diary/nearby' => 'diary_entry#list', :nearby => true, :via => :get, :as => "nearby_diaries"
+  match '/user/:display_name/diary/rss' => 'diary_entry#rss', :via => :get, :format => :rss
+  match '/diary/:language/rss' => 'diary_entry#rss', :via => :get, :format => :rss
+  match '/diary/rss' => 'diary_entry#rss', :via => :get, :format => :rss
+  match '/user/:display_name/diary/comments/:page' => 'diary_entry#comments', :via => :get, :page => /\d+/
+  match '/user/:display_name/diary/comments/' => 'diary_entry#comments', :via => :get
+  match '/user/:display_name/diary' => 'diary_entry#list', :via => :get
+  match '/diary/:language' => 'diary_entry#list', :via => :get
+  match '/diary' => 'diary_entry#list', :via => :get
+  match '/user/:display_name/diary/:id' => 'diary_entry#view', :via => :get, :id => /\d+/
+  match '/user/:display_name/diary/:id/newcomment' => 'diary_entry#comment', :via => :post, :id => /\d+/
+  match '/user/:display_name/diary/:id/edit' => 'diary_entry#edit', :via => [:get, :post], :id => /\d+/
+  match '/user/:display_name/diary/:id/hide' => 'diary_entry#hide', :via => :post, :id => /\d+/
+  match '/user/:display_name/diary/:id/hidecomment/:comment' => 'diary_entry#hidecomment', :via => :post, :id => /\d+/, :comment => /\d+/
 
   # user pages
-  match '/user/:display_name' => 'user#view'
-  match '/user/:display_name/make_friend' => 'user#make_friend'
-  match '/user/:display_name/remove_friend' => 'user#remove_friend'
-  match '/user/:display_name/account' => 'user#account'
-  match '/user/:display_name/set_status' => 'user#set_status'
-  match '/user/:display_name/delete' => 'user#delete'
+  match '/user/:display_name' => 'user#view', :via => :get
+  match '/user/:display_name/make_friend' => 'user#make_friend', :via => :get
+  match '/user/:display_name/remove_friend' => 'user#remove_friend', :via => :get
+  match '/user/:display_name/account' => 'user#account', :via => [:get, :post]
+  match '/user/:display_name/set_status' => 'user#set_status', :via => :get
+  match '/user/:display_name/delete' => 'user#delete', :via => :get
 
   # user lists
-  match '/users' => 'user#list'
-  match '/users/:status' => 'user#list'
-
-  # test pages
-  match '/test/populate/:table/:from/:count' => 'test#populate'
-  match '/test/populate/:table/:count' => 'test#populate', :from => 1
+  match '/users' => 'user#list', :via => [:get, :post]
+  match '/users/:status' => 'user#list', :via => [:get, :post]
 
   # geocoder
-  match '/geocoder/search' => 'geocoder#search'
-  match '/geocoder/search_latlon' => 'geocoder#search_latlon'
-  match '/geocoder/search_us_postcode' => 'geocoder#search_us_postcode'
-  match '/geocoder/search_uk_postcode' => 'geocoder#search_uk_postcode'
-  match '/geocoder/search_ca_postcode' => 'geocoder#search_ca_postcode'
-  match '/geocoder/search_osm_namefinder' => 'geocoder#search_osm_namefinder'
-  match '/geocoder/search_osm_nominatim' => 'geocoder#search_osm_nominatim'
-  match '/geocoder/search_geonames' => 'geocoder#search_geonames'
-  match '/geocoder/description' => 'geocoder#description'
-  match '/geocoder/description_osm_namefinder' => 'geocoder#description_osm_namefinder'
-  match '/geocoder/description_osm_nominatim' => 'geocoder#description_osm_nominatim'
-  match '/geocoder/description_geonames' => 'geocoder#description_geonames'
+  match '/geocoder/search' => 'geocoder#search', :via => :post
+  match '/geocoder/search_latlon' => 'geocoder#search_latlon', :via => :get
+  match '/geocoder/search_us_postcode' => 'geocoder#search_us_postcode', :via => :get
+  match '/geocoder/search_uk_postcode' => 'geocoder#search_uk_postcode', :via => :get
+  match '/geocoder/search_ca_postcode' => 'geocoder#search_ca_postcode', :via => :get
+  match '/geocoder/search_osm_namefinder' => 'geocoder#search_osm_namefinder', :via => :get
+  match '/geocoder/search_osm_nominatim' => 'geocoder#search_osm_nominatim', :via => :get
+  match '/geocoder/search_geonames' => 'geocoder#search_geonames', :via => :get
+  match '/geocoder/description' => 'geocoder#description', :via => :post
+  match '/geocoder/description_osm_namefinder' => 'geocoder#description_osm_namefinder', :via => :get
+  match '/geocoder/description_osm_nominatim' => 'geocoder#description_osm_nominatim', :via => :get
+  match '/geocoder/description_geonames' => 'geocoder#description_geonames', :via => :get
 
   # export
-  match '/export/start' => 'export#start'
-  match '/export/finish' => 'export#finish'
+  match '/export/start' => 'export#start', :via => :get
+  match '/export/finish' => 'export#finish', :via => :post
 
   # messages
-  match '/user/:display_name/inbox' => 'message#inbox'
-  match '/user/:display_name/outbox' => 'message#outbox'
-  match '/message/new/:display_name' => 'message#new'
-  match '/message/read/:message_id' => 'message#read'
-  match '/message/mark/:message_id' => 'message#mark'
-  match '/message/reply/:message_id' => 'message#reply'
-  match '/message/delete/:message_id' => 'message#delete'
+  match '/user/:display_name/inbox' => 'message#inbox', :via => :get, :as => "inbox"
+  match '/user/:display_name/outbox' => 'message#outbox', :via => :get, :as => "outbox"
+  match '/message/new/:display_name' => 'message#new', :via => [:get, :post]
+  match '/message/read/:message_id' => 'message#read', :via => :get
+  match '/message/mark/:message_id' => 'message#mark', :via => :post
+  match '/message/reply/:message_id' => 'message#reply', :via => [:get, :post]
+  match '/message/delete/:message_id' => 'message#delete', :via => :post
 
   # oauth admin pages (i.e: for setting up new clients, etc...)
   scope "/user/:display_name" do
@@ -242,15 +232,11 @@ OpenStreetMap::Application.routes.draw do
   match '/oauth/test_request' => 'oauth#test_request', :as => :test_request
 
   # roles and banning pages
-  match '/user/:display_name/role/:role/grant' => 'user_roles#grant'
-  match '/user/:display_name/role/:role/revoke' => 'user_roles#revoke'
-  match '/user/:display_name/blocks' => 'user_blocks#blocks_on'
-  match '/user/:display_name/blocks_by' => 'user_blocks#blocks_by'
-  match '/blocks/new/:display_name' => 'user_blocks#new'
+  match '/user/:display_name/role/:role/grant' => 'user_roles#grant', :via => [:get, :post]
+  match '/user/:display_name/role/:role/revoke' => 'user_roles#revoke', :via => [:get, :post]
+  match '/user/:display_name/blocks' => 'user_blocks#blocks_on', :via => :get
+  match '/user/:display_name/blocks_by' => 'user_blocks#blocks_by', :via => :get
+  match '/blocks/new/:display_name' => 'user_blocks#new', :via => :get
   resources :user_blocks
-  match '/blocks/:id/revoke' => 'user_blocks#revoke'
-
-  # fall through
-  match ':controller/:id/:action' => '#index'
-  match ':controller/:action' => '#index'
+  match '/blocks/:id/revoke' => 'user_blocks#revoke', :via => [:get, :post]
 end
index 0c19e2f4f2df1be9feb7d1f5817a90eb976d443e..15822bd7da2582890f29737bbe10138cc0f51c5b 100644 (file)
Binary files a/public/potlatch2/locales/ast.swf and b/public/potlatch2/locales/ast.swf differ
index 276f01d8aa77cf6baf3d37fa695acce9c28082f1..1d6296aa2f47698559f2b027e8be629616c914ec 100644 (file)
Binary files a/public/potlatch2/locales/br.swf and b/public/potlatch2/locales/br.swf differ
index d39cf158faba334fcfa6c1a1725000477f7e561c..7d1361a7dc338a8d57564fcf3abd75f87b73f576 100644 (file)
Binary files a/public/potlatch2/locales/de_DE.swf and b/public/potlatch2/locales/de_DE.swf differ
index 1586a7965d6671a7f2badd69f5a4b48860d70214..bd25d16e12da655df4dd20e7232a3ba1c3f4e3d9 100644 (file)
Binary files a/public/potlatch2/locales/en_GB.swf and b/public/potlatch2/locales/en_GB.swf differ
index 13050fa3734a1d2a8d64a3964fd8fcf8d80204bc..9dc8630b4e250f08f610cebede9dd6b89be7a4fd 100644 (file)
Binary files a/public/potlatch2/locales/en_US.swf and b/public/potlatch2/locales/en_US.swf differ
index ef995c1cf0a7f40f4256b4a038c8b9df09058423..298d7cfe7f7729e49215331e2abfc392b9276dd6 100644 (file)
Binary files a/public/potlatch2/locales/es_ES.swf and b/public/potlatch2/locales/es_ES.swf differ
index 49e6cdb49197e89b1802b17b44510b20a141e570..e334f2039b47467564c08890c338dd5177254a36 100644 (file)
Binary files a/public/potlatch2/locales/fi.swf and b/public/potlatch2/locales/fi.swf differ
index 705787164e355f7d991fd09e0bbb575f4539faec..b65e3ede324b6e89b00818d9b92329ce843b2675 100644 (file)
Binary files a/public/potlatch2/locales/fr_FR.swf and b/public/potlatch2/locales/fr_FR.swf differ
index 3838292830e1ca2c8222b161a1596fc398e3c7bb..dd61e160bf5a37c7a24373dfda7354c146579c4f 100644 (file)
Binary files a/public/potlatch2/locales/he.swf and b/public/potlatch2/locales/he.swf differ
index 66038f36dd9d3b8aa6c3c3c4719d2c8c389b9f14..772b366daa6356479c2ff49371ae9456e1293c42 100644 (file)
Binary files a/public/potlatch2/locales/hsb.swf and b/public/potlatch2/locales/hsb.swf differ
index b2022192491343676fcccf69a6924c281cbabcea..a0dd94810ca3f015e03da1550441dc9e25cbefa0 100644 (file)
Binary files a/public/potlatch2/locales/ja_JP.swf and b/public/potlatch2/locales/ja_JP.swf differ
index 61215e473b299fe2571c142d3e70cb3dbdd3d1d2..4c90b424e931750fc0caf8142d9730746e06be25 100644 (file)
Binary files a/public/potlatch2/locales/mk.swf and b/public/potlatch2/locales/mk.swf differ
index 0b09c6794e194a437289ef8648dfdd3b4cfbbfa7..851623e2309b246078c1593f3cf77d75bb90021c 100644 (file)
Binary files a/public/potlatch2/locales/ms.swf and b/public/potlatch2/locales/ms.swf differ
index 3dca073c7c9980b8ec801297961448cbe9110e55..9287969dd9874b8ad9f3f87a7d2ad8232f5a89dd 100644 (file)
Binary files a/public/potlatch2/locales/nb_NO.swf and b/public/potlatch2/locales/nb_NO.swf differ
index 544130ad214b92d1ae1c6a92afa309fce5dac0e0..c4abcad7b90302f50f7cef1fe4eff500b5035df3 100644 (file)
Binary files a/public/potlatch2/locales/nl_NL.swf and b/public/potlatch2/locales/nl_NL.swf differ
index ca73dfc23a63fcc6e795e863b9b79c1a0f581e93..006c5d236cfa87202fa462befac82a56c0f72485 100644 (file)
Binary files a/public/potlatch2/locales/nn_NO.swf and b/public/potlatch2/locales/nn_NO.swf differ
index 00f3d2a0b95610fe8f32fa8042cfaed42659a395..02024b5f296756403bd78c25d053531d8ee00e54 100644 (file)
Binary files a/public/potlatch2/locales/pl_PL.swf and b/public/potlatch2/locales/pl_PL.swf differ
index 68cce1c804297b58014b15b9aca449be1bb78177..6c506069de3873e1e5793735f17fdd3de8ebee31 100644 (file)
Binary files a/public/potlatch2/locales/ru.swf and b/public/potlatch2/locales/ru.swf differ
index 472338f5a2326deced6b1eeeedaa4db5ae483068..f65de2380a448a4d76fc4e5c5eafe565a99f1cc7 100644 (file)
Binary files a/public/potlatch2/locales/sq.swf and b/public/potlatch2/locales/sq.swf differ
index a7b500ea3dd98636d68e8ab0e7d4a1ec223ecb26..89e2e16e6f4a94c204251fd754a5bc5a414f127f 100644 (file)
Binary files a/public/potlatch2/locales/tr.swf and b/public/potlatch2/locales/tr.swf differ
index 703590e08a4ac3df956ead35acdd6ee2c256eeb1..9a00b3770958c1953edb70f8319391d5f0262e0c 100644 (file)
Binary files a/public/potlatch2/locales/vi_VN.swf and b/public/potlatch2/locales/vi_VN.swf differ
index bfcfd6730e91dec1c5bbb068aba58abea7182bcd..d0a7076dbe6e29c1a38588efcdb89e06b837a3f3 100644 (file)
Binary files a/public/potlatch2/locales/zh_CN.swf and b/public/potlatch2/locales/zh_CN.swf differ
index 10774290c2c74ab4df010b92b81aa5f0d92bb979..d2a082b2a4c284b347af70c12d0f7999d8ee8087 100644 (file)
Binary files a/public/potlatch2/potlatch2.swf and b/public/potlatch2/potlatch2.swf differ
index 8bef10bd15628d41cc9d9270d62aa7260d063580..46ff71eb734aad0ba57a3220105dd2870d6ba044 100644 (file)
@@ -5,6 +5,19 @@ include Potlatch
 class AmfControllerTest < ActionController::TestCase
   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
     # check a visible way
     id = current_ways(:visible_way).id
index 9226e38926e8195c082fbfcbda2e379efd0b9239..adc433fe07b44c7663b44ab4cc4bde07ab7d930b 100644 (file)
@@ -18,6 +18,31 @@ class ApiControllerTest < ActionController::TestCase
     # reall reject it, however this is to test to see if the api changes.
   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.
   # -------------------------------------
index f4da4c1a84b27cba9fcc95c7249299607b5318da..04b690ebf0119e3eb4816f51410503518e4d934c 100644 (file)
@@ -4,6 +4,43 @@ require 'browse_controller'
 class BrowseControllerTest < ActionController::TestCase
   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
     xhr :get, :start
     assert_response :success
index ef80433403e05b0d11ffc615159053aa10b37d6a..a586b3dee77ea43b9e30effa7e784afc7e2e83a9 100644 (file)
@@ -4,6 +4,79 @@ require 'changeset_controller'
 class ChangesetControllerTest < ActionController::TestCase
   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
   # -----------------------
index 738fbe67110e0f6dc8a23abd8cb8f7db50bb2845..7981edd958a15b82222b869ca45f08c1a4835d0b 100644 (file)
@@ -5,6 +5,86 @@ class DiaryEntryControllerTest < ActionController::TestCase
 
   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
     @request.cookies["_osm_username"] = users(:normal_user).display_name
 
@@ -42,31 +122,28 @@ class DiaryEntryControllerTest < ActionController::TestCase
   
   def test_editing_diary_entry
     @request.cookies["_osm_username"] = users(:normal_user).display_name
+    entry = diary_entries(:normal_user_entry_1)
 
     # Make sure that you are redirected to the login page when you are 
     # not logged in, without and with the id of the entry you want to edit
-    get :edit
+    get :edit, :display_name => entry.user.display_name, :id => entry.id
     assert_response :redirect
-    assert_redirected_to :controller => :user, :action => "login", :referer => "/diary_entry/edit"
+    assert_redirected_to :controller => :user, :action => "login", :referer => "/user/#{entry.user.display_name}/diary/#{entry.id}/edit"
     
-    get :edit, :id => diary_entries(:normal_user_entry_1).id
-    assert_response :redirect
-    assert_redirected_to :controller => :user, :action => "login", :referer => "/diary_entry/edit"
-    
-    # Verify that you get a not found error, when you don't pass an id
-    get(:edit, nil, {'user' => users(:normal_user).id})
+    # Verify that you get a not found error, when you pass a bogus id
+    get(:edit, {:display_name => entry.user.display_name, :id => 9999}, {'user' => entry.user.id})
     assert_response :not_found
     assert_select "html", :count => 1 do
       assert_select "body", :count => 1 do
         assert_select "div#content", :count => 1 do
-          assert_select "h2", :text => "No entry with the id:", :count => 1 
+          assert_select "h2", :text => "No entry with the id: 9999", :count => 1 
         end
       end
     end
     
     # Now pass the id, and check that you can edit it, when using the same 
     # user as the person who created the entry
-    get(:edit, {:id => diary_entries(:normal_user_entry_1).id}, {'user' => users(:normal_user).id})
+    get(:edit, {:display_name => entry.user.display_name, :id => entry.id}, {'user' => entry.user.id})
     assert_response :success
     assert_select "html", :count => 1 do
       assert_select "head", :count => 1 do
@@ -75,9 +152,9 @@ class DiaryEntryControllerTest < ActionController::TestCase
       assert_select "body", :count => 1 do
         assert_select "div#content", :count => 1 do 
           assert_select "h1", :text => /Edit diary entry/, :count => 1
-          assert_select "form[action='/diary_entry/#{diary_entries(:normal_user_entry_1).id}/edit'][method=post]", :count => 1 do
-            assert_select "input#diary_entry_title[name='diary_entry[title]'][value='#{diary_entries(:normal_user_entry_1).title}']", :count => 1
-            assert_select "textarea#diary_entry_body[name='diary_entry[body]']", :text => diary_entries(:normal_user_entry_1).body, :count => 1
+          assert_select "form[action='/user/#{entry.user.display_name}/diary/#{entry.id}/edit'][method=post]", :count => 1 do
+            assert_select "input#diary_entry_title[name='diary_entry[title]'][value='#{entry.title}']", :count => 1
+            assert_select "textarea#diary_entry_body[name='diary_entry[body]']", :text => entry.body, :count => 1
             assert_select "select#diary_entry_language_code", :count => 1
             assert_select "input#latitude[name='diary_entry[latitude]']", :count => 1
             assert_select "input#longitude[name='diary_entry[longitude]']", :count => 1
@@ -94,15 +171,15 @@ class DiaryEntryControllerTest < ActionController::TestCase
     new_latitude = "1.1"
     new_longitude = "2.2"
     new_language_code = "en"
-    post(:edit, {:id => diary_entries(:normal_user_entry_1).id, 'commit' => 'save', 
+    post(:edit, {:display_name => entry.user.display_name, :id => entry.id, 'commit' => 'save', 
       'diary_entry'=>{'title' => new_title, 'body' => new_body, 'latitude' => new_latitude,
       'longitude' => new_longitude, 'language_code' => new_language_code} },
-         {'user' => users(:normal_user).id})
+         {'user' => entry.user.id})
     assert_response :redirect
-    assert_redirected_to :action => :view, :id => diary_entries(:normal_user_entry_1).id
+    assert_redirected_to :action => :view, :display_name => entry.user.display_name, :id => entry.id
     
     # Now check that the new data is rendered, when logged in
-    get :view, {:id => diary_entries(:normal_user_entry_1).id, :display_name => 'test'}, {'user' => users(:normal_user).id}
+    get :view, {:display_name => entry.user.display_name, :id => entry.id}, {'user' => entry.user.id}
     assert_response :success
     assert_template 'diary_entry/view'
     assert_select "html", :count => 1 do
@@ -111,7 +188,7 @@ class DiaryEntryControllerTest < ActionController::TestCase
       end
       assert_select "body", :count => 1 do
         assert_select "div#content", :count => 1 do
-          assert_select "h2", :text => /#{users(:normal_user).display_name}'s diary/, :count => 1
+          assert_select "h2", :text => /#{entry.user.display_name}'s diary/, :count => 1
           assert_select "b", :text => /#{new_title}/, :count => 1
           # This next line won't work if the text has been run through the htmlize function
           # due to formatting that could be introduced
@@ -119,7 +196,7 @@ class DiaryEntryControllerTest < ActionController::TestCase
           assert_select "abbr[class=geo][title=#{number_with_precision(new_latitude, :precision => 4)}; #{number_with_precision(new_longitude, :precision => 4)}]", :count => 1
           # As we're not logged in, check that you cannot edit
           #print @response.body
-          assert_select "a[href='/user/#{users(:normal_user).display_name}/diary/#{diary_entries(:normal_user_entry_1).id}/edit']", :text => "Edit this entry", :count => 1
+          assert_select "a[href='/user/#{entry.user.display_name}/diary/#{entry.id}/edit']", :text => "Edit this entry", :count => 1
         end
       end
     end
@@ -127,7 +204,7 @@ class DiaryEntryControllerTest < ActionController::TestCase
     @request.cookies["_osm_username"] = users(:public_user).display_name
 
     # and when not logged in as the user who wrote the entry
-    get :view, {:id => diary_entries(:normal_user_entry_1).id, :display_name => 'test'}, {'user' => users(:public_user).id}
+    get :view, {:display_name => entry.user.display_name, :id => entry.id}, {'user' => entry.user.id}
     assert_response :success
     assert_template 'diary_entry/view'
     assert_select "html", :count => 1 do
@@ -143,8 +220,8 @@ class DiaryEntryControllerTest < ActionController::TestCase
           assert_select "p", :text => /#{new_body}/, :count => 1
           assert_select "abbr[class=geo][title=#{number_with_precision(new_latitude, :precision => 4)}; #{number_with_precision(new_longitude, :precision => 4)}]", :count => 1
           # As we're not logged in, check that you cannot edit
-          assert_select "span[class=hidden show_if_user_#{users(:normal_user).id}]", :count => 1 do
-            assert_select "a[href='/user/#{users(:normal_user).display_name}/diary/#{diary_entries(:normal_user_entry_1).id}/edit']", :text => "Edit this entry", :count => 1
+          assert_select "span[class=hidden show_if_user_#{entry.user.id}]", :count => 1 do
+            assert_select "a[href='/user/#{entry.user.display_name}/diary/#{entry.id}/edit']", :text => "Edit this entry", :count => 1
           end
         end
       end
index 0fa6398c16d0bd4aff69c220539740c284f59863..75ed34a4aa1d403fcaed7e506690eaeff79377a2 100644 (file)
@@ -1,7 +1,20 @@
 require File.dirname(__FILE__) + '/../test_helper'
 
 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
     xhr :get, :start
     assert_response :success
index f63fe518d0aa04925c04f91b2e45ad905f145013..b678125d2e4af3bb80be94e0dfc973b713a305be 100644 (file)
@@ -2,9 +2,57 @@ require File.dirname(__FILE__) + '/../test_helper'
 require 'geocoder_controller'
 
 class GeocoderControllerTest < ActionController::TestCase
+  ##
+  # test all routes which lead to this controller
+  def test_routes
+    assert_routing(
+      { :path => "/geocoder/search", :method => :post },
+      { :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.
-  def test_truth
-    assert true
+    assert_routing(
+      { :path => "/geocoder/description", :method => :post },
+      { :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
index 96f509cb0208b3548753e4fd5f351bdf65822b4c..a2bb1f805455a5d5645ae9e6801dcfacbd6082bf 100644 (file)
@@ -2,9 +2,44 @@ require File.dirname(__FILE__) + '/../test_helper'
 require 'message_controller'
 
 class MessageControllerTest < ActionController::TestCase
-
-  # Replace this with your real tests.
-  def test_truth
-    assert true
+  ##
+  # test all routes which lead to this controller
+  def test_routes
+    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/reply/1", :method => :post },
+      { :controller => "message", :action => "reply", :message_id => "1" }
+    )
+    assert_routing(
+      { :path => "/message/delete/1", :method => :post },
+      { :controller => "message", :action => "delete", :message_id => "1" }
+    )
   end
 end
index fdefd0896065f2dc521f31f4f41bce72ff9e77a0..5544728f194b9ae624e2c0fac27f4e6fbfb03f30 100644 (file)
@@ -3,6 +3,31 @@ require File.dirname(__FILE__) + '/../test_helper'
 class NodeControllerTest < ActionController::TestCase
   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
     # cannot read password from fixture as it is stored as MD5 digest
     ## First try with no auth
diff --git a/test/functional/oauth_clients_controller_test.rb b/test/functional/oauth_clients_controller_test.rb
new file mode 100644 (file)
index 0000000..64a1e4e
--- /dev/null
@@ -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
diff --git a/test/functional/oauth_controller_test.rb b/test/functional/oauth_controller_test.rb
new file mode 100644 (file)
index 0000000..b34416b
--- /dev/null
@@ -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
index 69ea0f345720a6e1d821c7bde8f5894c21d9e3fc..3c0358c2b9a7465704c953390ea017d9e1aba0d2 100644 (file)
@@ -8,6 +8,19 @@ class OldNodeControllerTest < ActionController::TestCase
   # 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
   # to the API and ensuring that later calls to version return the 
index 54e1cd037fad660bfc39ef2e4604b18db6550d20..89676a175a8f38872f0455246ab96de4dede3135 100644 (file)
@@ -4,6 +4,19 @@ require 'old_relation_controller'
 class OldRelationControllerTest < ActionController::TestCase
   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.
   # -------------------------------------
index 9dd542c525490856d9c826df7ae67d075e350273..f0ab6bd859409fc0fb3452dd8af335a25bebea60 100644 (file)
@@ -4,6 +4,19 @@ require 'old_way_controller'
 class OldWayControllerTest < ActionController::TestCase
   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.
   # -------------------------------------
index 8a59adb027cb28f3f6945591a5272ebb7dcf2b36..1f2640d4615ce728feabd965b57e5cbd94ab631a 100644 (file)
@@ -4,6 +4,48 @@ require 'relation_controller'
 class RelationControllerTest < ActionController::TestCase
   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.
   # -------------------------------------
index a213253ecd62cb6e854be8f7d789bdd58e470006..7fd060dc4548c98c714dc46c63c581ccddd6d195 100644 (file)
@@ -1,8 +1,24 @@
 require File.dirname(__FILE__) + '/../test_helper'
 
 class SearchControllerTest < ActionController::TestCase
-  # Replace this with your real tests.
-  def test_truth
-    assert true
+  ##
+  # test all routes which lead to this controller
+  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
index 4d2162a7161269985daf7cbb54a9a8509232af58..caef3481b66bc0c177865aaa3d29b4ed8ed24d3e 100644 (file)
@@ -3,6 +3,55 @@ require File.dirname(__FILE__) + '/../test_helper'
 class SiteControllerTest < ActionController::TestCase
   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 => :post },
+      { :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  
   # Get the index
   def test_index
index 862d3a8f02b9d73e315819c33b2084c13648ac32..09b8f3aae32634dac8eeec5f96464485eea6ecc1 100644 (file)
@@ -1,8 +1,12 @@
 require File.dirname(__FILE__) + '/../test_helper'
 
 class SwfControllerTest < ActionController::TestCase
-  # Replace this with your real tests.
-  def test_truth
-    assert true
+  ##
+  # test all routes which lead to this controller
+  def test_routes
+    assert_routing(
+      { :path => "/api/0.6/swf/trackpoints", :method => :get },
+      { :controller => "swf", :action => "trackpoints" }
+    )
   end
 end
index 28c09c8995c96d42acf8cd839bd40e0bdb0e4e78..8ff29c4377af083a91ce50d9aedcdea47fb0ae85 100644 (file)
@@ -4,6 +4,152 @@ class TraceControllerTest < ActionController::TestCase
   fixtures :users, :gpx_files
   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/edit", :method => :put },
+      { :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
   def test_list
     get :list
diff --git a/test/functional/user_blocks_controller_test.rb b/test/functional/user_blocks_controller_test.rb
new file mode 100644 (file)
index 0000000..adf0f36
--- /dev/null
@@ -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
index 309eb5e24ee41e3f93653a108887c86e0964e935..24daa1a6c708a718f8240d276aad3dc607e30687 100644 (file)
@@ -3,6 +3,178 @@ require File.dirname(__FILE__) + '/../test_helper'
 class UserControllerTest < ActionController::TestCase
   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
   def test_user_create_view
     get :new
index 2c6ca446bde6316a56ce906286fae651acca9747..3921fe5362e322580b3b3ae33609a5835e5cbda2 100644 (file)
@@ -2,7 +2,32 @@ require File.dirname(__FILE__) + '/../test_helper'
 
 class UserPreferenceControllerTest < ActionController::TestCase
   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
     # first try without auth
     get :read
@@ -21,5 +46,4 @@ class UserPreferenceControllerTest < ActionController::TestCase
       end
     end
   end
-
 end
diff --git a/test/functional/user_roles_controller_test.rb b/test/functional/user_roles_controller_test.rb
new file mode 100644 (file)
index 0000000..1e2d29b
--- /dev/null
@@ -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
index bba13062c0de9daa3c19c12cd75aa5fa48a44f77..a4b5a192a1bdafd7ea64e103bd5b5b9dbb516a98 100644 (file)
@@ -4,6 +4,35 @@ require 'way_controller'
 class WayControllerTest < ActionController::TestCase
   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.
   # -------------------------------------
index 8bf06374fc41601ed914b0197d2d51712cc26dd4..17531ef3fb8b6354f5d9c683760c9be6fe76c49a 100644 (file)
@@ -1,6 +1,6 @@
 require File.dirname(__FILE__) + '/../test_helper'
 
-class UserRolesControllerTest < ActionController::IntegrationTest
+class UserRolesTest < ActionController::IntegrationTest
   fixtures :users, :user_roles
 
   test "grant" do
index eac5daf2410511e62ea7a49d89df34b9a7bac8ea..64a101024738c3642bc8d5ebe07efe3accd425d7 100644 (file)
@@ -39,7 +39,7 @@ class UserTermsSeenTest < ActionController::IntegrationTest
       assert_response :success
 
       # don't agree to the terms, but hit decline
-      post "/user/#{user.display_name}/save", {'decline' => 'decline', 'referer' => '/'}
+      post "/user/save", {'decline' => 'decline', 'referer' => '/'}
       assert_redirected_to "/"
       follow_redirect!