diff options
-rw-r--r-- | .rubocop.yml | 2 | ||||
-rw-r--r-- | Rakefile | 4 | ||||
-rw-r--r-- | spec/mixlib/authentication/http_authentication_request_spec.rb | 24 | ||||
-rw-r--r-- | spec/mixlib/authentication/mixlib_authentication_spec.rb | 54 |
4 files changed, 43 insertions, 41 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index e69de29..5b837e2 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -0,0 +1,2 @@ +Style/HashSyntax: + Enabled: true @@ -3,7 +3,7 @@ require "rspec/core/rake_task" RSpec::Core::RakeTask.new(:spec) -task :default => :spec +task default: :spec begin require "chefstyle" @@ -15,4 +15,4 @@ rescue LoadError puts "chefstyle/rubocop is not available." end -task :ci => [:style, :spec] +task ci: [:style, :spec] diff --git a/spec/mixlib/authentication/http_authentication_request_spec.rb b/spec/mixlib/authentication/http_authentication_request_spec.rb index 0025cf4..7c45df1 100644 --- a/spec/mixlib/authentication/http_authentication_request_spec.rb +++ b/spec/mixlib/authentication/http_authentication_request_spec.rb @@ -64,18 +64,18 @@ describe Mixlib::Authentication::HTTPAuthenticationRequest do end it "normalizes the headers to lowercase symbols" do - expected = { :host => "127.0.0.1", - :x_ops_sign => "version=1.0", - :x_ops_requestid => "127.0.0.1 1258566194.85386", - :x_ops_timestamp => "2009-01-01T12:00:00Z", - :x_ops_content_hash => "DFteJZPVv6WKdQmMqZUQUumUyRs=", - :x_ops_userid => "spec-user", - :x_ops_authorization_1 => "jVHrNniWzpbez/eGWjFnO6lINRIuKOg40ZTIQudcFe47Z9e/HvrszfVXlKG4", - :x_ops_authorization_2 => "NMzYZgyooSvU85qkIUmKuCqgG2AIlvYa2Q/2ctrMhoaHhLOCWWoqYNMaEqPc", - :x_ops_authorization_3 => "3tKHE+CfvP+WuPdWk4jv4wpIkAz6ZLxToxcGhXmZbXpk56YTmqgBW2cbbw4O", - :x_ops_authorization_4 => "IWPZDHSiPcw//AYNgW1CCDptt+UFuaFYbtqZegcBd2n/jzcWODA7zL4KWEUy", - :x_ops_authorization_5 => "9q4rlh/+1tBReg60QdsmDRsw/cdO1GZrKtuCwbuD4+nbRdVBKv72rqHX9cu0", - :x_ops_authorization_6 => "utju9jzczCyB+sSAQWrxSsXB/b8vV2qs0l4VD2ML+w==" } + expected = { host: "127.0.0.1", + x_ops_sign: "version=1.0", + x_ops_requestid: "127.0.0.1 1258566194.85386", + x_ops_timestamp: "2009-01-01T12:00:00Z", + x_ops_content_hash: "DFteJZPVv6WKdQmMqZUQUumUyRs=", + x_ops_userid: "spec-user", + x_ops_authorization_1: "jVHrNniWzpbez/eGWjFnO6lINRIuKOg40ZTIQudcFe47Z9e/HvrszfVXlKG4", + x_ops_authorization_2: "NMzYZgyooSvU85qkIUmKuCqgG2AIlvYa2Q/2ctrMhoaHhLOCWWoqYNMaEqPc", + x_ops_authorization_3: "3tKHE+CfvP+WuPdWk4jv4wpIkAz6ZLxToxcGhXmZbXpk56YTmqgBW2cbbw4O", + x_ops_authorization_4: "IWPZDHSiPcw//AYNgW1CCDptt+UFuaFYbtqZegcBd2n/jzcWODA7zL4KWEUy", + x_ops_authorization_5: "9q4rlh/+1tBReg60QdsmDRsw/cdO1GZrKtuCwbuD4+nbRdVBKv72rqHX9cu0", + x_ops_authorization_6: "utju9jzczCyB+sSAQWrxSsXB/b8vV2qs0l4VD2ML+w==" } expect(@http_authentication_request.headers).to eq(expected) end diff --git a/spec/mixlib/authentication/mixlib_authentication_spec.rb b/spec/mixlib/authentication/mixlib_authentication_spec.rb index 2c233a2..6985741 100644 --- a/spec/mixlib/authentication/mixlib_authentication_spec.rb +++ b/spec/mixlib/authentication/mixlib_authentication_spec.rb @@ -316,45 +316,45 @@ PATH = "/organizations/clownco" HASHED_CANONICAL_PATH = "YtBWDn1blGGuFIuKksdwXzHU9oE=" # Base64.encode64(Digest::SHA1.digest("/organizations/clownco")).chomp V1_0_ARGS = { - :body => BODY, - :user_id => USER_ID, - :http_method => :post, - :timestamp => TIMESTAMP_ISO8601, # fixed timestamp so we get back the same answer each time. - :file => MockFile.new, - :path => PATH, + body: BODY, + user_id: USER_ID, + http_method: :post, + timestamp: TIMESTAMP_ISO8601, # fixed timestamp so we get back the same answer each time. + file: MockFile.new, + path: PATH, } V1_1_ARGS = { - :body => BODY, - :user_id => USER_ID, - :http_method => :post, - :timestamp => TIMESTAMP_ISO8601, # fixed timestamp so we get back the same answer each time. - :file => MockFile.new, - :path => PATH, - :proto_version => 1.1, + body: BODY, + user_id: USER_ID, + http_method: :post, + timestamp: TIMESTAMP_ISO8601, # fixed timestamp so we get back the same answer each time. + file: MockFile.new, + path: PATH, + proto_version: 1.1, } V1_3_ARGS_SHA256 = { - :body => BODY, - :user_id => USER_ID, - :http_method => :post, - :timestamp => TIMESTAMP_ISO8601, # fixed timestamp so we get back the same answer each time. - :file => MockFile.new, - :path => PATH, - :proto_version => "1.3", - :headers => { + body: BODY, + user_id: USER_ID, + http_method: :post, + timestamp: TIMESTAMP_ISO8601, # fixed timestamp so we get back the same answer each time. + file: MockFile.new, + path: PATH, + proto_version: "1.3", + headers: { "X-OpS-SeRvEr-ApI-VerSiOn" => "1", } # This defaults to sha256 } LONG_PATH_LONG_USER_ARGS = { - :body => BODY, - :user_id => "A" * 200, - :http_method => :put, - :timestamp => TIMESTAMP_ISO8601, # fixed timestamp so we get back the same answer each time. - :file => MockFile.new, - :path => PATH + "/nodes/#{"A" * 250}", + body: BODY, + user_id: "A" * 200, + http_method: :put, + timestamp: TIMESTAMP_ISO8601, # fixed timestamp so we get back the same answer each time. + file: MockFile.new, + path: PATH + "/nodes/#{"A" * 250}", } REQUESTING_ACTOR_ID = "c0f8a68c52bffa1020222a56b23cccfa" |