summaryrefslogtreecommitdiff
path: root/spec/mixlib
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2015-11-30 10:37:11 -0800
committerJay Mundrawala <jdmundrawala@gmail.com>2015-11-30 10:37:11 -0800
commit53fa0aa303713a99261d5182ccfea0c3bb06deb4 (patch)
treefb58c97b59a65b0b834dc06f5256ab34ed9193cb /spec/mixlib
parent09d47bde7f833fb13c59dac1fa12bd8a5c209106 (diff)
downloadmixlib-authentication-53fa0aa303713a99261d5182ccfea0c3bb06deb4.tar.gz
Use DEFAULT_SERVER_API_VERSION in all the placesjdm/sign-v1.3
Diffstat (limited to 'spec/mixlib')
-rw-r--r--spec/mixlib/authentication/http_authentication_request_spec.rb4
-rw-r--r--spec/mixlib/authentication/mixlib_authentication_spec.rb6
2 files changed, 10 insertions, 0 deletions
diff --git a/spec/mixlib/authentication/http_authentication_request_spec.rb b/spec/mixlib/authentication/http_authentication_request_spec.rb
index b0299b9..1c6c814 100644
--- a/spec/mixlib/authentication/http_authentication_request_spec.rb
+++ b/spec/mixlib/authentication/http_authentication_request_spec.rb
@@ -125,4 +125,8 @@ SIG
expect(@http_authentication_request.request_signature).to eq(expected.chomp)
end
+ it "defaults to server api version 0" do
+ expect(@http_authentication_request.server_api_version).to eq('0')
+ end
+
end
diff --git a/spec/mixlib/authentication/mixlib_authentication_spec.rb b/spec/mixlib/authentication/mixlib_authentication_spec.rb
index 4ae0876..41cd7e9 100644
--- a/spec/mixlib/authentication/mixlib_authentication_spec.rb
+++ b/spec/mixlib/authentication/mixlib_authentication_spec.rb
@@ -102,6 +102,10 @@ describe "Mixlib::Authentication::SignedHeaderAuth" do
expect(V1_3_SHA1_SIGNING_OBJECT.sign(PRIVATE_KEY)).to eq(EXPECTED_SIGN_RESULT_V1_3_SHA1)
end
+ it "should default to server api version 0 for version 1.3" do
+ expect(V1_3_SHA1_SIGNING_OBJECT_API0.server_api_version).to eq('0')
+ end
+
it "should generate the correct string to sign and signature for version 1.3 with SHA256" do
expect(V1_3_SHA256_SIGNING_OBJECT.proto_version).to eq("1.3")
expect(V1_3_SHA256_SIGNING_OBJECT.algorithm).to eq("sha256")
@@ -710,6 +714,8 @@ V1_3_SHA256_CANONICAL_REQUEST = V1_3_SHA256_CANONICAL_REQUEST_DATA.chomp
V1_3_SHA256_SIGNING_OBJECT = Mixlib::Authentication::SignedHeaderAuth.signing_object(V1_3_ARGS_SHA256)
V1_3_SHA1_SIGNING_OBJECT = Mixlib::Authentication::SignedHeaderAuth.signing_object(V1_3_ARGS_SHA1)
+V1_3_SHA1_SIGNING_OBJECT_API0 = Mixlib::Authentication::SignedHeaderAuth.signing_object(
+ V1_3_ARGS_SHA1.dup.tap {|x| x.delete(:headers)})
V1_1_SIGNING_OBJECT = Mixlib::Authentication::SignedHeaderAuth.signing_object(V1_1_ARGS)
V1_0_SIGNING_OBJECT = Mixlib::Authentication::SignedHeaderAuth.signing_object(V1_0_ARGS)
LONG_SIGNING_OBJECT = Mixlib::Authentication::SignedHeaderAuth.signing_object(LONG_PATH_LONG_USER_ARGS)