]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/api/map_controller_test.rb
Merge remote-tracking branch 'upstream/pull/2596'
[rails.git] / test / controllers / api / map_controller_test.rb
index c5392c723e776b54f03cae162065035c615d0c0e..9f14cc7fd8dbf8cd5512766a214105c2ce1a3ebb 100644 (file)
@@ -32,7 +32,7 @@ module Api
     ##
     # test http accept headers
     def test_http_accept_header
-      node = create(:node, :lat => 7, :lon => 7)
+      node = create(:node)
 
       minlon = node.lon - 0.1
       minlat = node.lat - 0.1
@@ -95,10 +95,15 @@ module Api
       assert_response :success, "Expected success with the map call"
       assert_equal "application/json; charset=utf-8", @response.header["Content-Type"]
 
-      # text/json is in invalid format, ActionController::UnknownFormat error is expected
+      # text/json is in invalid format, return HTTP 406 Not acceptable
       http_accept_format("text/json")
       get :index, :params => { :bbox => bbox }
-      assert_response :internal_server_error, "text/json should fail"
+      assert_response :not_acceptable, "text/json should fail"
+
+      # image/jpeg is a format which we don't support, return HTTP 406 Not acceptable
+      http_accept_format("image/jpeg")
+      get :index, :params => { :bbox => bbox }
+      assert_response :not_acceptable, "text/json should fail"
     end
 
     # -------------------------------------