require File.expand_path('../../../test_helper', __FILE__) module Maestrano module Saml class SettingsTest < Test::Unit::TestCase context "Settings" do setup do @settings = Maestrano::Saml::Settings.new end should "should provide getters and settings" do accessors = [ :assertion_consumer_service_url, :issuer, :sp_name_qualifier, :idp_sso_target_url, :idp_cert_fingerprint, :name_identifier_format, :idp_slo_target_url, :name_identifier_value, :sessionindex, :assertion_consumer_logout_service_url, :passive, :protocol_binding ] accessors.each do |accessor| value = Kernel.rand @settings.send("#{accessor}=".to_sym, value) assert_equal value, @settings.send(accessor) end end should "create settings from hash" do config = { :assertion_consumer_service_url => "http://app.muda.no/sso", :issuer => "http://muda.no", :sp_name_qualifier => "http://sso.muda.no", :idp_sso_target_url => "http://sso.muda.no/sso", :idp_slo_target_url => "http://sso.muda.no/slo", :idp_cert_fingerprint => "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00", :name_identifier_format => Maestrano::Saml::Settings::NAMEID_TRANSIENT, :passive => true, :protocol_binding => Maestrano::Saml::Settings::PROTOCOL_BINDING_POST } @settings = Maestrano::Saml::Settings.new(config) config.each do |k,v| assert_equal v, @settings.send(k) end end end end end end