1 require File.dirname(__FILE__) + '/../test_helper'
 
   3 class ExportControllerTest < ActionController::TestCase
 
   6   # test all routes which lead to this controller
 
   9       { :path => "/export/start", :method => :get },
 
  10       { :controller => "export", :action => "start" }
 
  13       { :path => "/export/finish", :method => :post },
 
  14       { :controller => "export", :action => "finish" }
 
  17       { :path => "/export/embed", :method => :get },
 
  18       { :controller => "export", :action => "embed" }
 
  23   # test the start action
 
  26     assert_response :success
 
  27     assert_template "export/start"
 
  31   # test the finish action for raw OSM data
 
  33     get :finish, {:minlon => 0, :minlat => 50, :maxlon => 1, :maxlat => 51, :format => 'osm'}
 
  34     assert_response :redirect
 
  35     assert_redirected_to "http://api.openstreetmap.org/api/#{API_VERSION}/map?bbox=0.0,50.0,1.0,51.0"
 
  39   # test the finish action for mapnik images
 
  40   def test_finish_mapnik
 
  41     get :finish, {:minlon => 0, :minlat => 50, :maxlon => 1, :maxlat => 51, :format => 'mapnik', :mapnik_format => 'test', :mapnik_scale => '12'}
 
  42     assert_response :redirect
 
  43     assert_redirected_to "http://render.openstreetmap.org/cgi-bin/export?bbox=0.0,50.0,1.0,51.0&scale=12&format=test"
 
  47   # test the embed action
 
  50     assert_response :success
 
  51     assert_template "export/embed"