summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Higgins <pete@peterhiggins.org>2020-12-16 17:05:38 -0800
committerPete Higgins <pete@peterhiggins.org>2020-12-16 17:05:38 -0800
commit8ddeb2dcc2ccdbbd89039258075553088fa413ce (patch)
tree643db8b715430f376aa8a9dc31feaa4525298239
parent87c0a58debaf1b69be80ce2f7b37b142b03a62fc (diff)
downloadchef-8ddeb2dcc2ccdbbd89039258075553088fa413ce.tar.gz
Backfill some missing tests and simplify the existing one.
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
-rw-r--r--spec/unit/http/ssl_policies_spec.rb18
1 files changed, 11 insertions, 7 deletions
diff --git a/spec/unit/http/ssl_policies_spec.rb b/spec/unit/http/ssl_policies_spec.rb
index 718378d670..2a7a70892a 100644
--- a/spec/unit/http/ssl_policies_spec.rb
+++ b/spec/unit/http/ssl_policies_spec.rb
@@ -188,16 +188,20 @@ describe "HTTP SSL Policy" do
let(:ssl_policy) { Chef::HTTP::APISSLPolicy.new(unconfigured_http_client) }
- context "when verify_api_cert is set" do
- before do
- Chef::Config[:verify_api_cert] = true
- end
+ it "sets the OpenSSL verify mode to verify_peer when configured with :ssl_verify_mode set to :verify_peer" do
+ Chef::Config[:ssl_verify_mode] = :verify_peer
+ expect(http_client.verify_mode).to eq(OpenSSL::SSL::VERIFY_PEER)
+ end
- it "sets the OpenSSL verify mode to verify_peer" do
- expect(http_client.verify_mode).to eq(OpenSSL::SSL::VERIFY_PEER)
- end
+ it "sets the OpenSSL verify mode to :verify_none when configured with :ssl_verify_mode set to :verify_none" do
+ Chef::Config[:ssl_verify_mode] = :verify_none
+ expect(http_client.verify_mode).to eq(OpenSSL::SSL::VERIFY_NONE)
end
+ it "sets the OpenSSL verify mode to verify_peer when verify_api_cert is set" do
+ Chef::Config[:verify_api_cert] = true
+ expect(http_client.verify_mode).to eq(OpenSSL::SSL::VERIFY_PEER)
+ end
end
describe Chef::HTTP::VerifyPeerSSLPolicy do