spec/akami/wsse_spec.rb in akami-1.2.1 vs spec/akami/wsse_spec.rb in akami-1.2.2

- old
+ new

@@ -23,10 +23,15 @@ it "contains the namespace for the PasswordDigest type" do Akami::WSSE::PASSWORD_DIGEST_URI.should == "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest" end + it "contains the namespace for Base64 Encoding type" do + Akami::WSSE::BASE64_URI.should == + "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" + end + describe "#credentials" do it "sets the username" do wsse.credentials "username", "password" wsse.username.should == "username" end @@ -119,11 +124,11 @@ it "contains the username and password" do wsse.to_xml.should include("username", "password") end it "does not contain a wsse:Nonce tag" do - wsse.to_xml.should_not match(/<wsse:Nonce>.*<\/wsse:Nonce>/) + wsse.to_xml.should_not match(/<wsse:Nonce.*>.*<\/wsse:Nonce>/) end it "does not contain a wsu:Created tag" do wsse.to_xml.should_not match(/<wsu:Created>.*<\/wsu:Created>/) end @@ -146,12 +151,12 @@ it "does not contain the (original) password" do wsse.to_xml.should_not include("password") end - it "contains a wsse:Nonce tag" do - wsse.to_xml.should match(/<wsse:Nonce>[^<]+<\/wsse:Nonce>/) + it "contains the Nonce base64 type attribute" do + wsse.to_xml.should include(Akami::WSSE::BASE64_URI) end it "contains a wsu:Created tag" do created_at = Time.now Timecop.freeze created_at do @@ -164,10 +169,10 @@ end it "should reset the nonce every time" do created_at = Time.now Timecop.freeze created_at do - nonce_regexp = /<wsse:Nonce>([^<]+)<\/wsse:Nonce>/ + nonce_regexp = /<wsse:Nonce.*>([^<]+)<\/wsse:Nonce>/ nonce_first = Base64.decode64(nonce_regexp.match(wsse.to_xml)[1]) nonce_second = Base64.decode64(nonce_regexp.match(wsse.to_xml)[1]) nonce_first.should_not == nonce_second end end