Sha256: 2d7ead833873798ff1db951d4926769dbe13e77a17a8bc0b7984929c72584eae

Contents?: true

Size: 1.7 KB

Versions: 36

Compression:

Stored size: 1.7 KB

Contents

require File.expand_path('../../../test_helper', __FILE__)

module Maestrano
  module SSO
    class BaseMembershipTest < Test::Unit::TestCase
      include SamlTestHelper
  
      setup do
        @saml_response = Maestrano::Saml::Response.new(response_document)
        @saml_response.stubs(:attributes).returns({
          'mno_session'          => 'f54sd54fd64fs5df4s3d48gf2',
          'mno_session_recheck'  => Time.now.utc.iso8601,
          'group_uid'            => 'cld-1',
          'group_end_free_trial' => Time.now.utc.iso8601,
          'group_role'           => 'Admin',
          'uid'                  => "usr-1",
          'virtual_uid'          => "usr-1.cld-1",
          'email'                => "j.doe@doecorp.com",
          'virtual_email'        => "usr-1.cld-1@mail.maestrano.com",
          'name'                 => "John",
          "surname"              => "Doe",
          "country"              => "AU",
          "company_name"         => "DoeCorp"
        })
      end
  
      should "extract the rights attributes from the saml response" do
        membership = Maestrano::SSO::BaseMembership.new(@saml_response)
        assert membership.group_uid == @saml_response.attributes['group_uid']
        assert membership.user_uid == @saml_response.attributes['uid']
        assert membership.role == @saml_response.attributes['group_role']
      end
  
      should "have the right hash representation" do
        membership = Maestrano::SSO::BaseMembership.new(@saml_response)
        assert membership.to_hash == {
          provider: 'maestrano',
          group_uid: membership.group_uid,
          user_uid: membership.user_uid,
          role: membership.role,
        }
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
maestrano-1.0.6 test/maestrano/sso/base_membership_test.rb
maestrano-1.0.5 test/maestrano/sso/base_membership_test.rb
maestrano-1.0.4 test/maestrano/sso/base_membership_test.rb
maestrano-1.0.3 test/maestrano/sso/base_membership_test.rb
maestrano-1.0.2 test/maestrano/sso/base_membership_test.rb
maestrano-1.0.1 test/maestrano/sso/base_membership_test.rb
maestrano-1.0.0 test/maestrano/sso/base_membership_test.rb
maestrano-1.0.0.pre.RC9 test/maestrano/sso/base_membership_test.rb
maestrano-1.0.0.pre.RC8 test/maestrano/sso/base_membership_test.rb
maestrano-1.0.0.pre.RC7 test/maestrano/sso/base_membership_test.rb
maestrano-1.0.0.pre.RC6 test/maestrano/sso/base_membership_test.rb
maestrano-1.0.0.pre.RC5 test/maestrano/sso/base_membership_test.rb
maestrano-1.0.0.pre.RC4 test/maestrano/sso/base_membership_test.rb
maestrano-1.0.0.pre.RC3 test/maestrano/sso/base_membership_test.rb
maestrano-1.0.0.pre.RC2 test/maestrano/sso/base_membership_test.rb
maestrano-1.0.0.pre.RC1 test/maestrano/sso/base_membership_test.rb
maestrano-0.12.5 test/maestrano/sso/base_membership_test.rb
maestrano-0.12.4 test/maestrano/sso/base_membership_test.rb
maestrano-0.12.3 test/maestrano/sso/base_membership_test.rb
maestrano-0.12.2 test/maestrano/sso/base_membership_test.rb