Permalink
Browse files

adding importer query parameter to failure callback

  • Loading branch information...
1 parent 159db44 commit 38e50bb77e11e80582db6d128e65767fb245f7a8 @hasghari hasghari committed Jan 22, 2013
@@ -84,7 +84,7 @@ def execute_and_rescue_exceptions
def handle_error error_type, exception
logger << ("Error #{error_type} while processing #{@env["PATH_INFO"]}: #{exception.message}") if logger
- [302, {"location" => "/contacts/failure?error_message=#{error_type}"}, []]
+ [302, {"location" => "/contacts/failure?error_message=#{error_type}&importer=#{class_name}"}, []]
end
def session
@@ -36,7 +36,7 @@ def redirect_path
get "/contacts/testprovider"
get "/contacts/testprovider/callback"
last_response.should be_redirect
- last_response.headers["location"].should eq("/contacts/failure?error_message=internal_error")
+ last_response.headers["location"].should eq("/contacts/failure?error_message=internal_error&importer=testprovider")
end
after(:all) do
@@ -50,7 +50,7 @@ def session
OAuth1Middleware.mock_auth_token_resp.should_receive(:body).and_raise("Request failed")
get "contacts/oauth1middleware"
last_response.should be_redirect
- last_response.headers["location"].should eq("/contacts/failure?error_message=internal_error")
+ last_response.headers["location"].should eq("/contacts/failure?error_message=internal_error&importer=oauth1middleware")
end
end
@@ -66,7 +66,7 @@ def session
OAuth1Middleware.mock_session.should_receive(:[]).and_return(nil)
get "/contacts/oauth1middleware/callback?oauth_token=token&oauth_verifier=verifier"
last_response.should be_redirect
- last_response.headers["location"].should eq("/contacts/failure?error_message=not_authorized")
+ last_response.headers["location"].should eq("/contacts/failure?error_message=not_authorized&importer=oauth1middleware")
end
end
end
@@ -56,7 +56,7 @@ def fetch_contacts_using_access_token token, token_type
it "should redirect to failure page because user did not allow access to contacts list" do
get '/redirect_path?error=not_authorized'
last_response.should be_redirect
- last_response.headers["location"].should eq("/contacts/failure?error_message=not_authorized")
+ last_response.headers["location"].should eq("/contacts/failure?error_message=not_authorized&importer=oauth2middleware")
end
end
end

0 comments on commit 38e50bb

Please sign in to comment.