summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel DeLeo <dan@opscode.com>2012-08-02 11:58:13 -0700
committerDaniel DeLeo <dan@opscode.com>2012-08-02 11:58:13 -0700
commitc7ad2f67c6feb508b2567c495abec13f018186d5 (patch)
tree519e8e097db16ef4b653df99c73e45c07ccf44d3
parenta47a14e569b5c0b12c476498dfb7a79d11e0bc8a (diff)
downloadmixlib-authentication-c7ad2f67c6feb508b2567c495abec13f018186d5.tar.gz
add a test for mixin usage since it's supported also
-rw-r--r--spec/mixlib/authentication/mixlib_authentication_spec.rb17
1 files changed, 14 insertions, 3 deletions
diff --git a/spec/mixlib/authentication/mixlib_authentication_spec.rb b/spec/mixlib/authentication/mixlib_authentication_spec.rb
index 2c5afe1..c16ab44 100644
--- a/spec/mixlib/authentication/mixlib_authentication_spec.rb
+++ b/spec/mixlib/authentication/mixlib_authentication_spec.rb
@@ -81,9 +81,6 @@ describe "Mixlib::Authentication::SignedHeaderAuth" do
end
it "should generate the correct string to sign and signature, version 1.1" do
- #algorithm = 'sha1'
- #version = '1.1'
-
V1_1_SIGNING_OBJECT.proto_version.should == "1.1"
V1_1_SIGNING_OBJECT.canonicalize_request.should == V1_1_CANONICAL_REQUEST
@@ -93,6 +90,20 @@ describe "Mixlib::Authentication::SignedHeaderAuth" do
V1_1_SIGNING_OBJECT.sign(PRIVATE_KEY).should == EXPECTED_SIGN_RESULT_V1_1
end
+ it "should generate the correct string to sign and signature for non-default proto version when used as a mixin" do
+ algorithm = 'sha1'
+ version = '1.1'
+
+ V1_1_SIGNING_OBJECT.proto_version = "1.0"
+ V1_1_SIGNING_OBJECT.proto_version.should == "1.0"
+ V1_1_SIGNING_OBJECT.canonicalize_request(algorithm, version).should == V1_1_CANONICAL_REQUEST
+
+ # If you need to regenerate the constants in this test spec, print out
+ # the results of res.inspect and copy them as appropriate into the
+ # the constants in this file.
+ V1_1_SIGNING_OBJECT.sign(PRIVATE_KEY, algorithm, version).should == EXPECTED_SIGN_RESULT_V1_1
+ end
+
it "should not choke when signing a request for a long user id with version 1.1" do
lambda { LONG_SIGNING_OBJECT.sign(PRIVATE_KEY, 'sha1', '1.1') }.should_not raise_error
end