spec/lib/response_spec.rb in saml2-1.1.5 vs spec/lib/response_spec.rb in saml2-2.0.0
- old
+ new
@@ -40,22 +40,28 @@
freeze_response
response.sign(fixture('certificate.pem'), fixture('privatekey.key'))
expect(Schemas.protocol.validate(response.to_xml)).to eq []
# verifiable on the command line with:
# xmlsec1 --verify --pubkey-cert-pem certificate.pem --privkey-pem privatekey.key --id-attr:ID urn:oasis:names:tc:SAML:2.0:assertion:Assertion response_signed.xml
- expect(response.to_s).to eq fixture('response_signed.xml')
+ expect(response.to_s(pretty: false)).to eq fixture('response_signed.xml')
end
it "should generate a valid signature when attributes are present" do
freeze_response
response.assertions.first.statements << sp.attribute_consuming_services.default.create_statement('givenName' => 'cody')
response.sign(fixture('certificate.pem'), fixture('privatekey.key'))
- expect(response.to_s).to eq fixture('response_with_attribute_signed.xml')
+ expect(response.to_s(pretty: false)).to eq fixture('response_with_attribute_signed.xml')
end
it "should generate valid XML for IdP initiated response" do
response = Response.initiate(sp, NameID.new('issuer'),
NameID.new('jacob', NameID::Format::PERSISTENT))
expect(Schemas.protocol.validate(Nokogiri::XML(response.to_s))).to eq []
+ end
+
+ it "parses a serialized assertion" do
+ response2 = Message.parse(response.to_s)
+ expect(response2.assertions.length).to eq 1
+ expect(response2.assertions.first.subject.name_id.id).to eq 'jacob'
end
end
end