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