From 619723603fae2ceb68ef2896618ba82053d3a03e Mon Sep 17 00:00:00 2001 From: Maggie Dreyer Date: Wed, 28 Nov 2018 16:07:36 -0800 Subject: [PATCH] Test the ability to disable raising exceptions --- spec/functions/lookup_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/functions/lookup_spec.rb b/spec/functions/lookup_spec.rb index 9d3b715..d5ddab0 100644 --- a/spec/functions/lookup_spec.rb +++ b/spec/functions/lookup_spec.rb @@ -58,6 +58,13 @@ }.to raise_error(Puppet::Error, %r{Unable to parse a hostname}) end + it 'returns nil instead of raising when raising is disabled' do + expect { + result = function.execute('/v1/whatever', 'vault.docker', false) + expect(result).to be(nil) + }.not_to raise_error(Puppet::Error) + end + it 'raises a Puppet error when auth fails' do connection = instance_double('Puppet::Network::HTTP::Connection', address: 'vault.doesnotexist') expect(Puppet::Network::HttpPool).to receive(:http_ssl_instance).and_return(connection)