Sha256: faca062fb53f081ce44c1e271aec3f96ed1804a085b92900a0c4f2851e512c5b

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require_relative '../spec_helper'

module SAML2
  describe LogoutRequest do
    let(:idp) { Entity.parse(fixture('identity_provider.xml')).roles.first }

    let(:logout_request) {
      LogoutRequest.initiate(idp,
                             NameID.new('issuer'),
                             NameID.new('jacob',
                                        name_qualifier: "a",
                                        sp_name_qualifier: "b"),
                             "abc")
    }

    it "should generate valid XML" do
      xml = logout_request.to_s
      expect(Schemas.protocol.validate(Nokogiri::XML(xml))).to eq []
    end

    it "parses" do
      # yup, I'm lazy
      new_request = LogoutRequest.parse(logout_request.to_s)
      expect(new_request.issuer.id).to eq 'issuer'
      expect(new_request.name_id.id).to eq 'jacob'
      expect(new_request.name_id.name_qualifier).to eq 'a'
      expect(new_request.name_id.sp_name_qualifier).to eq 'b'
      expect(new_request.session_index).to eq ['abc']
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
saml2-3.1.2 spec/lib/logout_request_spec.rb
saml2-3.1.1 spec/lib/logout_request_spec.rb
saml2-3.1.0 spec/lib/logout_request_spec.rb
saml2-3.0.11 spec/lib/logout_request_spec.rb
saml2-3.0.10 spec/lib/logout_request_spec.rb