renew the test codes

This commit is contained in:
raecoo 2011-08-29 20:07:57 +08:00
parent 3079ffcdae
commit e8de4f2f9e
2 changed files with 38 additions and 0 deletions

View File

@ -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'

View File

@ -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