Sha256: 298f15597375c2f07b3f4dae3140b4c97e24047e84340e4287f5486048dbb682
Contents?: true
Size: 1.55 KB
Versions: 4
Compression:
Stored size: 1.55 KB
Contents
require 'spec_helper.rb' describe Rack::OAuth2::Server::Authorize::Token do context "when authorized" do before do # NOTE: for some reason, test fails when called Rack::OAuth2::Server::Authorization::Token directly @app = Rack::OAuth2::Server::Authorize.new do |request, response| response.approve! response.access_token = "access_token" end @request = Rack::MockRequest.new @app end it "should redirect to redirect_uri with authorization code" do response = @request.get("/?response_type=token&client_id=client&redirect_uri=http://client.example.com/callback") response.status.should == 302 response.location.should == "http://client.example.com/callback#access_token=access_token" end end context "when denied" do before do # NOTE: for some reason, test fails when called Rack::OAuth2::Server::Authorization::Code directly @app = Rack::OAuth2::Server::Authorize.new do |request, response| raise Rack::OAuth2::Server::Unauthorized.new(:access_denied, 'User rejected the requested access.', :redirect_uri => request.redirect_uri) end @request = Rack::MockRequest.new @app end it "should redirect to redirect_uri with error message" do response = @request.get("/?response_type=token&client_id=client&redirect_uri=http://client.example.com/callback") response.status.should == 302 response.location.should == "http://client.example.com/callback?error_description=User+rejected+the+requested+access.&error=access_denied" end end end
Version data entries
4 entries across 4 versions & 1 rubygems