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