Skip to content
Snippets Groups Projects
Commit 743d3df9 authored by Derek Lindahl's avatar Derek Lindahl
Browse files

Added intentionally partial test for invalid ticket failures

parent 71367090
No related branches found
No related tags found
No related merge requests found
......@@ -26,7 +26,7 @@ module OmniAuth
return fail!(:no_ticket, 'No CAS Ticket') unless ticket
# validator = ServiceTicketValidator.new(@configuration, callback_url, ticket)
# @user_info = validator.user_info
return fail!(:invalid_ticket, 'Invalid CAS Ticket') if @user_info.empty?
return fail!(:invalid_ticket, 'Invalid CAS Ticket') if @user_info.nil? or @user_info.empty?
super
end
......
......@@ -42,17 +42,20 @@ describe OmniAuth::Strategies::CAS, :type => :strategy do
end
end
# describe 'GET /auth/cas/callback with an invalid ticket' do
# before do
# # stub_request(:get, /^https:\/\/cas.example.org(:443)?\/serviceValidate\?([^&]+&)?ticket=9391d/).
# # to_return(:body => File.read(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cas_failure.xml')))
# # get '/auth/cas/callback?ticket=9391d'
# end
# it 'should fail'# do
# # last_response.should be_redirect
# # last_response.headers['Location'].should =~ /invalid_ticket/
# # end
# end
describe 'GET /auth/cas/callback with an invalid ticket' do
before do
# stub_request(:get, /^https:\/\/cas.example.org(:443)?\/serviceValidate\?([^&]+&)?ticket=9391d/).
# to_return(:body => File.read(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cas_failure.xml')))
get '/auth/cas/callback?ticket=9391d'
end
subject { last_response }
it { should be_redirect }
it 'should have a failure message' do
subject.headers['Location'].should =~ /message=invalid_ticket/
end
end
# describe 'GET /auth/cas/callback with a valid ticket' do
# before do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment