Skip to content

Commit

Permalink
(PE-31696) Update mocks to set up correct http response
Browse files Browse the repository at this point in the history
Based on puppetlabs/puppet@e0dab29 update the mocks to construct the proper http response for the error.
  • Loading branch information
donoghuc committed Jul 7, 2021
1 parent 63f98a2 commit b44ea1e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions spec/unit/puppet/resource/catalog/certless_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,10 @@
allow(request).to receive(:options).and_return(request_options)

# need a Net::HTTP response
uri = URI.parse('https://www.example.com')
stub_request(:post, 'https://www.example.com')
.to_return(status: 404, headers: { "Content-Type" => 'application/json' })
net_http_response = Net::HTTP.post(uri, {})
puppet_http_response = Puppet::HTTP::Response.new(net_http_response, uri)
http_response = Net::HTTP.post(uri, '')
puppet_http_response = Puppet::HTTP::ResponseNetHTTP.new(uri, http_response)

allow(compiler).to receive(:post_catalog4).and_raise(Puppet::HTTP::ResponseError.new(puppet_http_response))

Expand Down

0 comments on commit b44ea1e

Please sign in to comment.