source: subversion/sites/rails_port/test/functional/api_controller_test.rb @ 4834

Last change on this file since 4834 was 4834, checked in by gabriel, 12 years ago

Merge rails_port_0.5

File size: 930 bytes
Line 
1require File.dirname(__FILE__) + '/../test_helper'
2require 'api_controller'
3
4# Re-raise errors caught by the controller.
5class ApiController; def rescue_action(e) raise e end; end
6
7class ApiControllerTest < Test::Unit::TestCase
8  api_fixtures
9
10  def setup
11    @controller = ApiController.new
12    @request    = ActionController::TestRequest.new
13    @response   = ActionController::TestResponse.new
14  end
15
16  def basic_authorization(user, pass)
17    @request.env["HTTP_AUTHORIZATION"] = "Basic %s" % Base64.encode64("#{user}:#{pass}")
18  end
19
20  # -------------------------------------
21  # Test reading a bounding box.
22  # -------------------------------------
23
24  def test_map
25    node = current_nodes(:used_node_1)
26    bbox = "#{node.latitude-0.1},#{node.longitude-0.1},#{node.latitude+0.1},#{node.longitude+0.1}"
27    get :map, :bbox => bbox
28    if $VERBOSE
29        print @response.body
30    end
31    assert_response :success
32  end
33
34end
Note: See TracBrowser for help on using the repository browser.