- post "/oauth/revoke", :token => token.token
- assert_redirected_to oauth_clients_url(token.user.display_name)
- token = OauthToken.find_by_token(token.token)
- assert_not_nil token.invalidated_at
-
- signed_get "/api/0.6/gpx/2", :consumer => client, :token => token
- assert_response :unauthorized
- end
-
- def test_oauth10_desktop_app
- client = client_applications(:oauth_desktop_app)
-
- post_via_redirect "/login",
- :username => client.user.email, :password => "test"
- assert_response :success
-
- signed_get "/oauth/request_token", :consumer => client
- assert_response :success
- token = parse_token(response)
- assert_instance_of RequestToken, token
- assert_not_nil token.created_at
- assert_nil token.authorized_at
- assert_nil token.invalidated_at
- assert_allowed token, client.permissions
-
- post "/oauth/authorize",
- :oauth_token => token.token,
- :allow_read_prefs => true, :allow_write_prefs => true
- assert_response :success
- assert_template "authorize_success"
- token.reload
- assert_not_nil token.created_at
- assert_not_nil token.authorized_at
- assert_nil token.invalidated_at
- assert_allowed token, [:allow_read_prefs]
-
- signed_get "/oauth/access_token", :consumer => client, :token => token
- assert_response :success
- token.reload
- assert_not_nil token.created_at
- assert_not_nil token.authorized_at
- assert_not_nil token.invalidated_at
- token = parse_token(response)
- assert_instance_of AccessToken, token
- assert_not_nil token.created_at
- assert_not_nil token.authorized_at
- assert_nil token.invalidated_at
- assert_allowed token, [:allow_read_prefs]
-
- signed_get "/api/0.6/user/preferences", :consumer => client, :token => token
- assert_response :success