diff options
author | Loic ANTOINE-GOMBEAUD <loweekee@gmail.com> | 2012-12-19 08:07:47 +0000 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2013-03-06 10:51:54 -0800 |
commit | f1ed72c39f2be2364098d7789b10b1aace59d0a6 (patch) | |
tree | 83b4e719c40e1cd6ba126de9122c3ca63c472abd | |
parent | ecadbd7f18791b576e8a3ab1cae238748eeece38 (diff) | |
download | chef-f1ed72c39f2be2364098d7789b10b1aace59d0a6.tar.gz |
[CHEF-2682] add test case for InvalidRedirect exception
-rw-r--r-- | lib/chef/formatters/error_inspectors/registration_error_inspector.rb | 2 | ||||
-rw-r--r-- | spec/unit/rest_spec.rb | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/chef/formatters/error_inspectors/registration_error_inspector.rb b/lib/chef/formatters/error_inspectors/registration_error_inspector.rb index db36f593cd..f31b348278 100644 --- a/lib/chef/formatters/error_inspectors/registration_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/registration_error_inspector.rb @@ -42,7 +42,7 @@ E validation_key "#{api_key}" E when Chef::Exceptions::InvalidRedirect - error_description.section("Invalid Redirect:",<<-E + error_description.section("Invalid Redirect:",<<-E) Change your server location in client.rb to the server's FQDN to avoid unwanted redirections. E else diff --git a/spec/unit/rest_spec.rb b/spec/unit/rest_spec.rb index 4609caf5dc..a1ee607eb3 100644 --- a/spec/unit/rest_spec.rb +++ b/spec/unit/rest_spec.rb @@ -347,8 +347,12 @@ describe Chef::REST do @http_client.stub!(:request).and_yield(http_response).and_return(http_response) lambda { @rest.api_request(:GET, @url) }.should raise_error(Chef::Exceptions::RedirectLimitExceeded) + + [:PUT, :POST, :DELETE].each do |method| + lambda { @rest.api_request(method, @url) }.should raise_error(Chef::Exceptions::InvalidRedirect) + end end - end + end it "should return `false` when response is 304 NotModified" do http_response = Net::HTTPNotModified.new("1.1", "304", "it's the same as when you asked 5 minutes ago") |