1 require File.dirname(__FILE__) + '/../test_helper'
2 require 'browse_controller'
4 class BrowseControllerTest < ActionController::TestCase
7 def basic_authorization(user, pass)
8 @request.env["HTTP_AUTHORIZATION"] = "Basic %s" % Base64.encode64("#{user}:#{pass}")
12 @request.env["RAW_POST_DATA"] = c.to_s
15 # We need to load the home page, then activate the start rjs method
16 # and finally check that the new panel has loaded.
21 # This should display the last 20 nodes that were edited.
23 @nodes = Node.find(:all, :order => "timestamp DESC", :limit => 20)
24 assert @nodes.size <= 20
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
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})"
38 # Test reading a relation
39 def test_read_relation
43 def test_read_relation_history
51 def test_read_way_history
59 def test_read_node_history
63 def test_read_changeset