]> git.openstreetmap.org Git - rails.git/blob - test/functional/browse_controller_test.rb
Resyncing from head 10895:11795
[rails.git] / test / functional / browse_controller_test.rb
1 require File.dirname(__FILE__) + '/../test_helper'
2 require 'browse_controller'
3
4 class BrowseControllerTest < ActionController::TestCase
5   api_fixtures
6
7   def basic_authorization(user, pass)
8     @request.env["HTTP_AUTHORIZATION"] = "Basic %s" % Base64.encode64("#{user}:#{pass}")
9   end
10
11   def content(c)
12     @request.env["RAW_POST_DATA"] = c.to_s
13   end
14
15   # We need to load the home page, then activate the start rjs method
16   # and finally check that the new panel has loaded.
17   def test_start
18   
19   end
20   
21   # This should display the last 20 nodes that were edited.
22   def test_index
23     @nodes = Node.find(:all, :order => "timestamp DESC", :limit => 20)
24     assert @nodes.size <= 20
25     get :index
26     assert_response :success
27     assert_template "index"
28     # Now check that all 20 (or however many were returned) nodes are in the html
29     assert_select "h2", :text => "#{@nodes.size} Recently Changed Nodes", :count => 1
30     assert_select "ul[id='recently_changed'] li a", :count => @nodes.size
31     @nodes.each do |node|
32       name = node.tags_as_hash['name'].to_s
33       name = "(No name)" if name.length == 0
34       assert_select "ul[id='recently_changed'] li a[href=/browse/node/#{node.id}]", :text => "#{name} - #{node.id} (#{node.version})"
35     end
36   end
37   
38   # Test reading a relation
39   def test_read_relation
40     
41   end
42   
43   def test_read_relation_history
44     
45   end
46   
47   def test_read_way
48     
49   end
50   
51   def test_read_way_history
52     
53   end
54   
55   def test_read_node
56     
57   end
58   
59   def test_read_node_history
60     
61   end
62   
63   def test_read_changeset
64     
65   end
66 end