@@ -111,6 +111,16 @@ class MetadataTest < Minitest::Test
111111 settings . certificate = ruby_saml_cert_text
112112 end
113113
114+ it "generates Service Provider Metadata with X509Certificate for sign" do
115+ assert_equal 1 , key_descriptors . length
116+ assert_equal "signing" , key_descriptors [ 0 ] . attribute ( "use" ) . value
117+
118+ assert_equal 1 , cert_nodes . length
119+ assert_equal ruby_saml_cert . to_der , cert . to_der
120+
121+ assert validate_xml! ( xml_text , "saml-schema-metadata-2.0.xsd" )
122+ end
123+
114124 describe "and signed authentication requests" do
115125 before do
116126 settings . security [ :authn_requests_signed ] = true
@@ -122,16 +132,6 @@ class MetadataTest < Minitest::Test
122132
123133 assert validate_xml! ( xml_text , "saml-schema-metadata-2.0.xsd" )
124134 end
125-
126- it "generates Service Provider Metadata with X509Certificate for sign" do
127- assert_equal 1 , key_descriptors . length
128- assert_equal "signing" , key_descriptors [ 0 ] . attribute ( "use" ) . value
129-
130- assert_equal 1 , cert_nodes . length
131- assert_equal ruby_saml_cert . to_der , cert . to_der
132-
133- assert validate_xml! ( xml_text , "saml-schema-metadata-2.0.xsd" )
134- end
135135 end
136136
137137 describe "and encrypted assertions" do
@@ -140,12 +140,11 @@ class MetadataTest < Minitest::Test
140140 end
141141
142142 it "generates Service Provider Metadata with X509Certificate for encrypt" do
143- assert_equal 1 , key_descriptors . length
144- assert_equal "encryption" , key_descriptors [ 0 ] . attribute ( "use" ) . value
145-
146- assert_equal 1 , cert_nodes . length
147- assert_equal ruby_saml_cert . to_der , cert . to_der
143+ assert_equal 2 , key_descriptors . length
144+ assert_equal "encryption" , key_descriptors [ 1 ] . attribute ( "use" ) . value
148145
146+ assert_equal 2 , cert_nodes . length
147+ assert_equal cert_nodes [ 0 ] . text , cert_nodes [ 1 ] . text
149148 assert validate_xml! ( xml_text , "saml-schema-metadata-2.0.xsd" )
150149 end
151150 end
0 commit comments