summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2015-12-07 18:29:49 +0000
committerThom May <thom@chef.io>2015-12-09 11:52:52 +0000
commite88b8d345053ac8ebe1f273326178b7cc27b0845 (patch)
treec10dd64e54a6961c5308868f5f951a74881a774d
parent2d915fee09e402bdba8928d28fdc12fa6c37f4c9 (diff)
downloadchef-e88b8d345053ac8ebe1f273326178b7cc27b0845.tar.gz
expose HTTP optionstm/fix_reg_tests_2
and use it in registration client specs
-rw-r--r--lib/chef/http.rb2
-rw-r--r--spec/unit/api_client/registration_spec.rb3
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/chef/http.rb b/lib/chef/http.rb
index 4f08dc90b2..9f1eeed55f 100644
--- a/lib/chef/http.rb
+++ b/lib/chef/http.rb
@@ -74,6 +74,7 @@ class Chef
attr_reader :sign_on_redirect
attr_reader :redirect_limit
+ attr_reader :options
attr_reader :middlewares
# Create a HTTP client object. The supplied +url+ is used as the base for
@@ -86,6 +87,7 @@ class Chef
@sign_on_redirect = true
@redirects_followed = 0
@redirect_limit = 10
+ @options = options
@middlewares = []
self.class.middlewares.each do |middleware_class|
diff --git a/spec/unit/api_client/registration_spec.rb b/spec/unit/api_client/registration_spec.rb
index 05d1793a4a..58d64990f3 100644
--- a/spec/unit/api_client/registration_spec.rb
+++ b/spec/unit/api_client/registration_spec.rb
@@ -94,6 +94,9 @@ describe Chef::ApiClient::Registration do
it "has an HTTP client configured with validator credentials" do
expect(registration.http_api).to be_a_kind_of(Chef::ServerAPI)
+ expect(registration.http_api.options[:client_name]).to eq("test-validator")
+ auth = registration.http_api.middlewares.select { |klass| klass.kind_of? Chef::HTTP::Authenticator }.first
+ expect(auth.client_name).to eq("test-validator")
end
describe "when creating/updating the client on the server" do