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 changesets closed.
23 @changesets = Changeset.find(:all, :order => "closed_at DESC", :conditions => ['closed_at < ?', Time.now], :limit=> 20)
24 assert @changesets.size <= 20
26 assert_response :success
27 assert_template "index"
28 # Now check that all 20 (or however many were returned) changesets are in the html
29 assert_select "h2", :text => "#{@changesets.size} Recently Closed Changesets", :count => 1
30 assert_select "ul[id='recently_changed'] li a", :count => @changesets.size
31 @changesets.each do |changeset|
32 if changeset.user.data_public?
33 user = changeset.user.display_name
38 cmt = changeset.tags_as_hash['comment'].to_s
39 cmt = "(no comment)" if cmt.length == 0
40 text = "#{changeset.id} by #{user} - #{cmt}"
41 assert_select "ul[id='recently_changed'] li a[href=/browse/changeset/#{changeset.id}]", :text => text
45 # Test reading a relation
46 def test_read_relation
50 def test_read_relation_history
58 def test_read_way_history
66 def test_read_node_history
70 def test_read_changeset