Permalink
Browse files

renew the test codes

  • Loading branch information...
1 parent 3079ffc commit e8de4f2f9e5dc77710692e3f44b60555e91b50b6 @raecoo raecoo committed Aug 29, 2011
Showing with 38 additions and 0 deletions.
  1. +1 −0 oa-enterprise/oa-enterprise.gemspec
  2. +37 −0 oa-enterprise/spec/omniauth/strategies/saml_spec.rb
@@ -8,6 +8,7 @@ Gem::Specification.new do |gem|
gem.add_dependency 'oa-core', OmniAuth::Version::STRING
gem.add_dependency 'pyu-ruby-sasl', '~> 0.0.3.1'
gem.add_dependency 'rubyntlm', '~> 0.1.1'
+ gem.add_dependency 'uuid'
gem.add_dependency 'XMLCanonicalizer', '~> 1.0.1'
gem.add_development_dependency 'rack-test', '~> 0.5'
gem.add_development_dependency 'rake', '~> 0.8'
@@ -0,0 +1,37 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+
+describe OmniAuth::Strategies::SAML, :type => :strategy do
+
+ include OmniAuth::Test::StrategyTestCase
+
+ def strategy
+ [OmniAuth::Strategies::SAML, {
+ :assertion_consumer_service_url => "http://consumer.service.url/auth/saml/callback",
+ :issuer => "https://saml.issuer.url/issuers/29490",
+ :idp_sso_target_url => "https://idp.sso.target_url/signon/29490",
+ :idp_cert_fingerprint => "E7:91:B2:E1:4C:65:2C:49:F3:33:74:0A:58:5A:7E:55:F7:15:7A:33",
+ :name_identifier_format => "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
+ }]
+ end
+
+ describe 'GET /auth/saml' do
+ before do
+ get '/auth/saml'
+ end
+
+ it 'should get authentication page' do
+ last_response.should be_redirect
+ end
+ end
+
+ describe 'POST /auth/saml/callback' do
+
+ it 'should raise ArgumentError exception without the SAMLResponse parameter' do
+ post '/auth/saml/callback'
+ last_response.should be_redirect
+ last_response.location.should == '/auth/failure?message=invalid_ticket'
+ end
+
+ end
+
+end

0 comments on commit e8de4f2

Please sign in to comment.