Move user details route to api namespace
This commit is contained in:
parent
b31ac7430e
commit
e6b23c133e
2 changed files with 10 additions and 10 deletions
|
@ -67,13 +67,13 @@ OpenStreetMap::Application.routes.draw do
|
||||||
|
|
||||||
get "trackpoints" => "tracepoints#index"
|
get "trackpoints" => "tracepoints#index"
|
||||||
|
|
||||||
get "user/details" => "users#details"
|
|
||||||
get "user/gpx_files" => "users#gpx_files"
|
get "user/gpx_files" => "users#gpx_files"
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :api, :path => "api/0.6" do
|
namespace :api, :path => "api/0.6" do
|
||||||
resources :users, :only => :index
|
resources :users, :only => :index
|
||||||
resources :users, :path => "user", :id => /\d+/, :only => :show
|
resources :users, :path => "user", :id => /\d+/, :only => :show
|
||||||
|
get "user/details" => "users#details"
|
||||||
|
|
||||||
resources :user_preferences, :except => [:new, :create, :edit], :param => :preference_key, :path => "user/preferences" do
|
resources :user_preferences, :except => [:new, :create, :edit], :param => :preference_key, :path => "user/preferences" do
|
||||||
collection do
|
collection do
|
||||||
|
|
|
@ -156,12 +156,12 @@ module Api
|
||||||
create(:message, :sender => user)
|
create(:message, :sender => user)
|
||||||
|
|
||||||
# check that nothing is returned when not logged in
|
# check that nothing is returned when not logged in
|
||||||
get user_details_path
|
get api_user_details_path
|
||||||
assert_response :unauthorized
|
assert_response :unauthorized
|
||||||
|
|
||||||
# check that we get a response when logged in
|
# check that we get a response when logged in
|
||||||
auth_header = bearer_authorization_header user
|
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_response :success
|
||||||
assert_equal "application/xml", response.media_type
|
assert_equal "application/xml", response.media_type
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ module Api
|
||||||
|
|
||||||
# check that data is returned properly in json
|
# check that data is returned properly in json
|
||||||
auth_header = bearer_authorization_header user
|
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_response :success
|
||||||
assert_equal "application/json", response.media_type
|
assert_equal "application/json", response.media_type
|
||||||
|
|
||||||
|
@ -191,11 +191,11 @@ module Api
|
||||||
email_auth = bearer_authorization_header(user, :scopes => %w[read_prefs read_email])
|
email_auth = bearer_authorization_header(user, :scopes => %w[read_prefs read_email])
|
||||||
|
|
||||||
# check that we can't fetch details as XML without read_prefs
|
# 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
|
assert_response :forbidden
|
||||||
|
|
||||||
# check that we can fetch details as XML without read_email
|
# 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_response :success
|
||||||
assert_equal "application/xml", response.media_type
|
assert_equal "application/xml", response.media_type
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ module Api
|
||||||
check_xml_details(user, true, false)
|
check_xml_details(user, true, false)
|
||||||
|
|
||||||
# check that we can fetch details as XML with read_email
|
# 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_response :success
|
||||||
assert_equal "application/xml", response.media_type
|
assert_equal "application/xml", response.media_type
|
||||||
|
|
||||||
|
@ -211,11 +211,11 @@ module Api
|
||||||
check_xml_details(user, true, true)
|
check_xml_details(user, true, true)
|
||||||
|
|
||||||
# check that we can't fetch details as JSON without read_prefs
|
# 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
|
assert_response :forbidden
|
||||||
|
|
||||||
# check that we can fetch details as JSON without read_email
|
# 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_response :success
|
||||||
assert_equal "application/json", response.media_type
|
assert_equal "application/json", response.media_type
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ module Api
|
||||||
check_json_details(js, user, true, false)
|
check_json_details(js, user, true, false)
|
||||||
|
|
||||||
# check that we can fetch details as JSON with read_email
|
# 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_response :success
|
||||||
assert_equal "application/json", response.media_type
|
assert_equal "application/json", response.media_type
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue