summaryrefslogtreecommitdiffstats
path: root/spec/unit/network
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-04-13 18:46:55 -0700
committerNick Lewis <nick@puppetlabs.com>2011-04-13 19:09:48 -0700
commit9bc4bcefb1a9f2545b4828dcea7a41ef450e7d52 (patch)
tree7657ff423ac8783880550c3f4990593fdad0c253 /spec/unit/network
parent7817ccb3438ad2742a98694373e42b65df86eda7 (diff)
downloadpuppet-9bc4bcefb1a9f2545b4828dcea7a41ef450e7d52.tar.gz
puppet-9bc4bcefb1a9f2545b4828dcea7a41ef450e7d52.tar.xz
puppet-9bc4bcefb1a9f2545b4828dcea7a41ef450e7d52.zip
(#7103) Fix HEAD requests in the HTTP handler
HEAD request support was implemented in 2.6.x, and the internal API in the HTTP handler changed in 2.7.x. So when the branches were merged together, HEAD requests ended up using the wrong API without any visible merge conflicts or spec failures. This fixes them to use the correct API. Reviewed-By: Matt Robinson
Diffstat (limited to 'spec/unit/network')
-rwxr-xr-xspec/unit/network/http/handler_spec.rb18
1 files changed, 7 insertions, 11 deletions
diff --git a/spec/unit/network/http/handler_spec.rb b/spec/unit/network/http/handler_spec.rb
index 83969c504..c709d82fe 100755
--- a/spec/unit/network/http/handler_spec.rb
+++ b/spec/unit/network/http/handler_spec.rb
@@ -240,34 +240,30 @@ describe Puppet::Network::HTTP::Handler do
describe "when performing head operation" do
before do
- @irequest = stub 'indirection_request', :method => :head, :indirection_name => "my_handler", :to_hash => {}, :key => "my_result", :model => @model_class
+ @handler.stubs(:model).with("my_handler").returns(stub 'model', :indirection => @model_class)
+ @handler.stubs(:http_method).with(@request).returns("HEAD")
+ @handler.stubs(:path).with(@request).returns("/production/my_handler/my_result")
+ @handler.stubs(:params).with(@request).returns({})
@model_class.stubs(:head).returns true
end
- it "should use the indirection request to find the model class" do
- @irequest.expects(:model).returns @model_class
-
- @handler.do_head(@irequest, @request, @response)
- end
-
it "should use the escaped request key" do
@model_class.expects(:head).with do |key, args|
key == "my_result"
end.returns true
- @handler.do_head(@irequest, @request, @response)
+ @handler.process(@request, @response)
end
it "should not generate a response when a model head call succeeds" do
@handler.expects(:set_response).never
- @handler.do_head(@irequest, @request, @response)
+ @handler.process(@request, @response)
end
it "should return a 404 when the model head call returns false" do
- @model_class.stubs(:name).returns "my name"
@handler.expects(:set_response).with { |response, body, status| status == 404 }
@model_class.stubs(:head).returns(false)
- @handler.do_head(@irequest, @request, @response)
+ @handler.process(@request, @response)
end
end