Skip to content
Browse files

Test that single sign out XML is valid.

This test will ensure that the single sign out XML can be parsed
and the service ticket can be retrieved.
  • Loading branch information...
1 parent cdc7d7c commit b9fefdff23425e5f7c33b10617f891646d10d92e @adamcrown adamcrown committed Dec 5, 2012
Showing with 30 additions and 2 deletions.
  1. +9 −2 Gemfile.lock
  2. +2 −0 rubycas-server.gemspec
  3. +18 −0 spec/casserver/cas_spec.rb
  4. +1 −0 spec/spec_helper.rb
View
11 Gemfile.lock
@@ -40,6 +40,7 @@ GEM
xpath (~> 0.1.4)
childprocess (0.3.6)
ffi (~> 1.0, >= 1.0.6)
+ crack (0.3.1)
crypt-isaac (0.9.1)
diff-lcs (1.1.3)
ffi (1.1.5)
@@ -64,7 +65,8 @@ GEM
rack-test (0.6.2)
rack (>= 1.0)
rake (0.8.7)
- rb-fsevent (0.9.2)
+ rb-inotify (0.8.8)
+ ffi (>= 0.5.0)
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
@@ -90,6 +92,9 @@ GEM
thor (0.16.0)
tilt (1.3.3)
tzinfo (0.3.33)
+ webmock (1.9.0)
+ addressable (>= 2.2.7)
+ crack (>= 0.1.7)
xpath (0.1.4)
nokogiri (~> 1.3)
@@ -103,10 +108,12 @@ DEPENDENCIES
guard (~> 1.4.0)
guard-rspec (= 2.0.0)
net-ldap (~> 0.1.1)
+ nokogiri (~> 1.3)
rack-test
rake (= 0.8.7)
- rb-fsevent (~> 0.9.2)
+ rb-inotify (~> 0.8.8)
rspec
rspec-core
rubycas-server!
sqlite3 (~> 1.3.1)
+ webmock (~> 1.8)
View
2 rubycas-server.gemspec
@@ -44,6 +44,8 @@ For more information on RubyCAS-Server, see http://code.google.com/p/rubycas-ser
s.add_development_dependency("appraisal", "~> 0.4.1")
s.add_development_dependency("guard", "~> 1.4.0")
s.add_development_dependency("guard-rspec", "2.0.0")
+ s.add_development_dependency("webmock", "~> 1.8")
+ s.add_development_dependency("nokogiri", "~> 1.3")
# pull in os specific FS monitoring lib for guard
case RUBY_PLATFORM
View
18 spec/casserver/cas_spec.rb
@@ -2,6 +2,8 @@
module CASServer; end
require 'casserver/cas'
+require 'nokogiri'
+require 'cgi'
describe CASServer::CAS do
before do
@@ -127,4 +129,20 @@ module CASServer; end
@pt.ticket.should match /^PT-/
end
end
+
+ describe "#send_logout_notification_for_service_ticket(st)" do
+ it "should send valid single sign out XML to the service URL" do
+ service_stub = stub_request(:post, 'http://example.com')
+ st = CASServer::Model::ServiceTicket.new(
+ :ticket => 'ST-0123456789ABCDEFGHIJKLMNOPQRS',
+ :service => 'http://example.com'
+ )
+ @host.send_logout_notification_for_service_ticket(st)
+
+ a_request(:post, 'example.com').with{ |req|
+ xml = CGI.parse(req.body)['logoutRequest'].first
+ Nokogiri::XML(xml).at_xpath('//samlp:SessionIndex').text.strip == st.ticket
+ }.should have_been_made
+ end
+ end
end
View
1 spec/spec_helper.rb
@@ -5,6 +5,7 @@
#require 'spec/interop/test'
require 'logger'
require 'ostruct'
+require 'webmock/rspec'
require 'capybara'
require 'capybara/dsl'

0 comments on commit b9fefdf

Please sign in to comment.
Something went wrong with that request. Please try again.