def test_oauth10_web_app
client = create(:client_application, :callback_url => "http://some.web.app.example.org/callback", :allow_read_prefs => true, :allow_write_api => true, :allow_read_gpx => true)
+ user = create(:user)
get "/login"
follow_redirect!
- post "/login", :params => { :username => client.user.email, :password => "test" }
+ post "/login", :params => { :username => user.email, :password => "test" }
follow_redirect!
assert_response :success
def test_oauth10_desktop_app
client = create(:client_application, :allow_read_prefs => true, :allow_write_api => true, :allow_read_gpx => true)
+ user = create(:user)
get "/login"
follow_redirect!
- post "/login", :params => { :username => client.user.email, :password => "test" }
+ post "/login", :params => { :username => user.email, :password => "test" }
follow_redirect!
assert_response :success
def test_oauth10a_web_app
client = create(:client_application, :callback_url => "http://some.web.app.example.org/callback", :allow_read_prefs => true, :allow_write_api => true, :allow_read_gpx => true)
+ user = create(:user)
get "/login"
follow_redirect!
- post "/login", :params => { :username => client.user.email, :password => "test" }
+ post "/login", :params => { :username => user.email, :password => "test" }
follow_redirect!
assert_response :success
def test_oauth10a_desktop_app
client = create(:client_application, :allow_read_prefs => true, :allow_write_api => true, :allow_read_gpx => true)
+ user = create(:user)
get "/login"
follow_redirect!
- post "/login", :params => { :username => client.user.email, :password => "test" }
+ post "/login", :params => { :username => user.email, :password => "test" }
follow_redirect!
assert_response :success
assert_nil token.invalidated_at
assert_allowed token, [:allow_write_api, :allow_read_gpx]
- trace = create(:trace, :user => client.user)
+ trace = create(:trace, :user => token.user)
signed_get "/api/0.6/gpx/#{trace.id}", :oauth => { :token => token }
assert_response :success
signed_get "/api/0.6/user/preferences", :oauth => { :token => token }
assert_response :success
- trace = create(:trace, :user => client.user)
+ trace = create(:trace, :user => token.user)
signed_get "/api/0.6/gpx/#{trace.id}", :oauth => { :token => token }
assert_response :forbidden
assert_nil token.invalidated_at
assert_allowed token, [:allow_write_api, :allow_read_gpx]
- trace = create(:trace, :user => client.user)
+ trace = create(:trace, :user => token.user)
signed_get "/api/0.6/gpx/#{trace.id}", :oauth => { :token => token }
assert_response :success