]> git.openstreetmap.org Git - rails.git/blob - test/controllers/export_controller_test.rb
Merge remote-tracking branch 'upstream/pull/4705'
[rails.git] / test / controllers / export_controller_test.rb
1 require "test_helper"
2
3 class ExportControllerTest < ActionDispatch::IntegrationTest
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     post export_finish_path(:minlon => 0, :minlat => 50, :maxlon => 1, :maxlat => 51, :format => "osm")
21     assert_redirected_to "controller" => "api/map", "action" => "index", "bbox" => "0.0,50.0,1.0,51.0"
22   end
23
24   ###
25   # test the finish action for mapnik images
26   def test_finish_mapnik
27     post export_finish_path(:minlon => 0, :minlat => 50, :maxlon => 1, :maxlat => 51, :format => "mapnik", :mapnik_format => "test", :mapnik_scale => "12")
28     assert_redirected_to "https://render.openstreetmap.org/cgi-bin/export?bbox=0.0,50.0,1.0,51.0&scale=12&format=test"
29   end
30
31   ##
32   # test the embed action
33   def test_embed
34     get export_embed_path
35     assert_response :success
36     assert_template "export/embed"
37   end
38 end