- post "/oauth/authorize",
- :oauth_token => token.token,
- :allow_read_prefs => true, :allow_write_prefs => true
- assert_response :success
- assert_template "authorize_success"
- m = response.body.match("<p>The verification code is ([A-Za-z0-9]+).</p>")
- assert_not_nil m
- verifier = m[1]
- 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 :unauthorized
-
- signed_get "/oauth/access_token",
- :consumer => client, :token => token, :oauth_verifier => verifier
- 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
-
- 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/user/preferences", :consumer => client, :token => token
- assert_response :unauthorized