]> git.openstreetmap.org Git - rails.git/blob - test/controllers/export_controller_test.rb
Add frozen_string_literal comments to ruby files
[rails.git] / test / controllers / export_controller_test.rb
1 # frozen_string_literal: true
2
3 require "test_helper"
4
5 class ExportControllerTest < ActionDispatch::IntegrationTest
6   ##
7   # test all routes which lead to this controller
8   def test_routes
9     assert_routing(
10       { :path => "/export/finish", :method => :post },
11       { :controller => "export", :action => "finish" }
12     )
13     assert_routing(
14       { :path => "/export/embed", :method => :get },
15       { :controller => "export", :action => "embed" }
16     )
17   end
18
19   ###
20   # test the finish action for raw OSM data
21   def test_finish_osm
22     post export_finish_path(:minlon => 0, :minlat => 50, :maxlon => 1, :maxlat => 51, :format => "osm")
23     assert_redirected_to api_map_path(: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     post export_finish_path(:minlon => 0, :minlat => 50, :maxlon => 1, :maxlat => 51, :format => "mapnik", :mapnik_format => "test", :mapnik_scale => "12")
30     assert_redirected_to "https://render.openstreetmap.org/cgi-bin/export?bbox=0.0,50.0,1.0,51.0&scale=12&format=test&token="
31   end
32
33   ###
34   # test the finish action for cyclemap images
35   def test_finish_cyclemap
36     post export_finish_path(:minlon => 0, :minlat => 50, :maxlon => 1, :maxlat => 51, :format => "cyclemap", :mapnik_scale => 12, :mapnik_format => "png", :zoom => 17, :lat => 1, :lon => 2, :width => 400, :height => 300)
37     assert_redirected_to "https://tile.thunderforest.com/static/cycle/2,1,17/400x300.png?apikey=#{Settings.thunderforest_key}"
38   end
39
40   ###
41   # test the finish action for transport images
42   def test_finish_transport
43     post export_finish_path(:minlon => 0, :minlat => 50, :maxlon => 1, :maxlat => 51, :format => "transportmap", :mapnik_scale => 12, :mapnik_format => "png", :zoom => 17, :lat => 1, :lon => 2, :width => 400, :height => 300)
44     assert_redirected_to "https://tile.thunderforest.com/static/transport/2,1,17/400x300.png?apikey=#{Settings.thunderforest_key}"
45   end
46
47   ##
48   # test the embed action
49   def test_embed
50     get export_embed_path
51     assert_response :success
52     assert_template "export/embed"
53   end
54 end