summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormokha <mokha@cisco.com>2018-03-05 16:47:36 -0700
committermokha <mokha@cisco.com>2018-03-05 16:47:36 -0700
commitce888449b832f0bbef1dfa87dfc44bc488c8f23b (patch)
treee09af30bf095f1ab3031d1ed98be36eaf8aed640
parent0aa0fbb7de8b9e84d3f36d085b4d769b67fcc90e (diff)
add specs for decoding a post.
-rw-r--r--spec/saml/kit/cli/commands/decode_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/saml/kit/cli/commands/decode_spec.rb b/spec/saml/kit/cli/commands/decode_spec.rb
index a1fd717..6bf4b77 100644
--- a/spec/saml/kit/cli/commands/decode_spec.rb
+++ b/spec/saml/kit/cli/commands/decode_spec.rb
@@ -16,4 +16,23 @@ RSpec.describe Saml::Kit::Cli::Commands::Certificate do
specify { expect(output).to include("Decoded #{document.send(:name)}") }
specify { pending; expect(output).to include(document.signature.certificate.x509.to_text) }
end
+
+ describe "#psot" do
+ let(:command) { "decode post #{post_binding.serialize(builder)[1]['SAMLResponse']}" }
+ let(:document) { builder.build }
+ let(:user) { double(name_id_for: SecureRandom.uuid) }
+ let(:builder) do
+ Saml::Kit::Response.builder(user) do |x|
+ x.sign_with(Xml::Kit::KeyPair.generate(use: :signing))
+ end
+ end
+ let(:post_binding) do
+ Saml::Kit::Bindings::HttpPost.new(location: 'https://www.example.com/')
+ end
+
+ specify { expect(status).to be_success }
+ specify { expect(output).to include(document.to_xml(pretty: true)) }
+ specify { expect(output).to include("Decoded #{document.send(:name)}") }
+ specify { expect(output).to include(document.signature.certificate.x509.to_text) }
+ end
end