X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/7df13ff2d3b369b571b6d85fd1a2997290c5541f..fb7762feb979bf7d106d7e87785d6a39cb540405:/test/controllers/api/users_controller_test.rb?ds=sidebyside diff --git a/test/controllers/api/users_controller_test.rb b/test/controllers/api/users_controller_test.rb index 874d91771..90ef1999d 100644 --- a/test/controllers/api/users_controller_test.rb +++ b/test/controllers/api/users_controller_test.rb @@ -21,10 +21,6 @@ module Api { :path => "/api/0.6/user/details.json", :method => :get }, { :controller => "api/users", :action => "details", :format => "json" } ) - assert_routing( - { :path => "/api/0.6/user/gpx_files", :method => :get }, - { :controller => "api/users", :action => "gpx_files" } - ) assert_routing( { :path => "/api/0.6/users", :method => :get }, { :controller => "api/users", :action => "index" } @@ -156,12 +152,12 @@ module Api create(:message, :sender => user) # check that nothing is returned when not logged in - get user_details_path + get api_user_details_path assert_response :unauthorized # check that we get a response when logged in auth_header = bearer_authorization_header user - get user_details_path, :headers => auth_header + get api_user_details_path, :headers => auth_header assert_response :success assert_equal "application/xml", response.media_type @@ -170,7 +166,7 @@ module Api # check that data is returned properly in json auth_header = bearer_authorization_header user - get user_details_path(:format => "json"), :headers => auth_header + get api_user_details_path(:format => "json"), :headers => auth_header assert_response :success assert_equal "application/json", response.media_type @@ -191,11 +187,11 @@ module Api email_auth = bearer_authorization_header(user, :scopes => %w[read_prefs read_email]) # check that we can't fetch details as XML without read_prefs - get user_details_path, :headers => bad_auth + get api_user_details_path, :headers => bad_auth assert_response :forbidden # check that we can fetch details as XML without read_email - get user_details_path, :headers => good_auth + get api_user_details_path, :headers => good_auth assert_response :success assert_equal "application/xml", response.media_type @@ -203,7 +199,7 @@ module Api check_xml_details(user, true, false) # check that we can fetch details as XML with read_email - get user_details_path, :headers => email_auth + get api_user_details_path, :headers => email_auth assert_response :success assert_equal "application/xml", response.media_type @@ -211,11 +207,11 @@ module Api check_xml_details(user, true, true) # check that we can't fetch details as JSON without read_prefs - get user_details_path(:format => "json"), :headers => bad_auth + get api_user_details_path(:format => "json"), :headers => bad_auth assert_response :forbidden # check that we can fetch details as JSON without read_email - get user_details_path(:format => "json"), :headers => good_auth + get api_user_details_path(:format => "json"), :headers => good_auth assert_response :success assert_equal "application/json", response.media_type @@ -227,7 +223,7 @@ module Api check_json_details(js, user, true, false) # check that we can fetch details as JSON with read_email - get user_details_path(:format => "json"), :headers => email_auth + get api_user_details_path(:format => "json"), :headers => email_auth assert_response :success assert_equal "application/json", response.media_type @@ -405,33 +401,6 @@ module Api assert_select "user", :count => 0 end - def test_gpx_files - user = create(:user) - trace1 = create(:trace, :user => user) do |trace| - create(:tracetag, :trace => trace, :tag => "London") - end - trace2 = create(:trace, :user => user) do |trace| - create(:tracetag, :trace => trace, :tag => "Birmingham") - end - # check that nothing is returned when not logged in - get user_gpx_files_path - assert_response :unauthorized - - # check that we get a response when logged in - auth_header = bearer_authorization_header user - get user_gpx_files_path, :headers => auth_header - assert_response :success - assert_equal "application/xml", response.media_type - - # check the data that is returned - assert_select "gpx_file[id='#{trace1.id}']", 1 do - assert_select "tag", "London" - end - assert_select "gpx_file[id='#{trace2.id}']", 1 do - assert_select "tag", "Birmingham" - end - end - private def check_xml_details(user, include_private, include_email)