]> git.openstreetmap.org Git - rails.git/blob - test/functional/export_controller_test.rb
Merge branch 'master' into redesign
[rails.git] / test / functional / export_controller_test.rb
1 require File.dirname(__FILE__) + '/../test_helper'
2
3 class ExportControllerTest < ActionController::TestCase
4
5   ##
6   # test all routes which lead to this controller
7   def test_routes
8     assert_routing(
9       { :path => "/export/finish", :method => :post },
10       { :controller => "export", :action => "finish" }
11     )
12     assert_routing(
13       { :path => "/export/embed", :method => :get },
14       { :controller => "export", :action => "embed" }
15     )
16   end
17
18   ###
19   # test the finish action for raw OSM data
20   def test_finish_osm
21     get :finish, {:minlon => 0, :minlat => 50, :maxlon => 1, :maxlat => 51, :format => 'osm'}
22     assert_response :redirect
23     assert_redirected_to "http://api.openstreetmap.org/api/#{API_VERSION}/map?bbox=0.0,50.0,1.0,51.0"
24   end
25   
26   ###
27   # test the finish action for mapnik images
28   def test_finish_mapnik
29     get :finish, {:minlon => 0, :minlat => 50, :maxlon => 1, :maxlat => 51, :format => 'mapnik', :mapnik_format => 'test', :mapnik_scale => '12'}
30     assert_response :redirect
31     assert_redirected_to "http://render.openstreetmap.org/cgi-bin/export?bbox=0.0,50.0,1.0,51.0&scale=12&format=test"
32   end
33
34   ##
35   # test the embed action
36   def test_embed
37     get :embed
38     assert_response :success
39     assert_template "export/embed"
40   end
41
42 end