Sha256: ca2c3915677f9cce8763992f3417cbb4125ebc88b713c68119180b51a5a9be27
Contents?: true
Size: 1.86 KB
Versions: 11
Compression:
Stored size: 1.86 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), "test_helper")) class RequestTest < Test::Unit::TestCase context "Authrequest" do should "create the deflated SAMLRequest URL parameter" do settings = Cie::Saml::Settings.new settings.idp_sso_target_url = "http://example.com" auth_url = Cie::Saml::Authrequest.new.create(settings) assert auth_url =~ /^http:\/\/example\.com\?SAMLRequest=/ payload = CGI.unescape(auth_url.split("=").last) decoded = Base64.decode64(payload) zstream = Zlib::Inflate.new(-Zlib::MAX_WBITS) inflated = zstream.inflate(decoded) zstream.finish zstream.close assert_match /^<samlp:AuthnRequest/, inflated end should "accept extra parameters" do settings = Cie::Saml::Settings.new settings.idp_sso_target_url = "http://example.com" auth_url = Cie::Saml::Authrequest.new.create(settings, { :hello => "there" }) assert auth_url =~ /&hello=there$/ auth_url = Cie::Saml::Authrequest.new.create(settings, { :hello => nil }) assert auth_url =~ /&hello=$/ end context "when the target url doesn't contain a query string" do should "create the SAMLRequest parameter correctly" do settings = Cie::Saml::Settings.new settings.idp_sso_target_url = "http://example.com" auth_url = Cie::Saml::Authrequest.new.create(settings) assert auth_url =~ /^http:\/\/example.com\?SAMLRequest/ end end context "when the target url contains a query string" do should "create the SAMLRequest parameter correctly" do settings = Cie::Saml::Settings.new settings.idp_sso_target_url = "http://example.com?field=value" auth_url = Cie::Saml::Authrequest.new.create(settings) assert auth_url =~ /^http:\/\/example.com\?field=value&SAMLRequest/ end end end end
Version data entries
11 entries across 11 versions & 1 rubygems