]> git.openstreetmap.org Git - rails.git/blob - test/functional/api_controller_test.rb
Now just got one test to sort on the functional tests. All other tests are working...
[rails.git] / test / functional / api_controller_test.rb
1 require File.dirname(__FILE__) + '/../test_helper'
2 require 'api_controller'
3
4 # Re-raise errors caught by the controller.
5 class ApiController; def rescue_action(e) raise e end; end
6
7 class 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.lat-0.1},#{node.lon-0.1},#{node.lat+0.1},#{node.lon+0.1}"
27     get :map, :bbox => bbox
28     if $VERBOSE
29         print @response.body
30     end
31     assert_response :success
32   end
33
34 end