Skip to content

Commit c2da416

Browse files
committed
Fix tests
1 parent 330d41f commit c2da416

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

spec/unit/puppet/provider/dsc_base_provider/dsc_base_provider_spec.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@
439439
mof_is_embedded: false
440440
},
441441
dsc_psdscrunascredential: {
442-
type: 'Optional[Struct[{ user => String[1], password => Sensitive[String[1]] }]]',
442+
type: 'Optional[Struct[{ user => String[1], password => Variant[String[1], Sensitive[String[1]]] }]]',
443443
behaviour: :parameter,
444444
mandatory_for_get: false,
445445
mandatory_for_set: false,
@@ -886,7 +886,7 @@
886886
mof_is_embedded: false
887887
},
888888
dsc_psdscrunascredential: {
889-
type: 'Optional[Struct[{ user => String[1], password => Sensitive[String[1]] }]]',
889+
type: 'Optional[Struct[{ user => String[1], password => Variant[String[1], Sensitive[String[1]]] }]]',
890890
desc: 'The Credential to run DSC under',
891891
behaviour: :parameter,
892892
mandatory_for_get: false,
@@ -1552,6 +1552,8 @@
15521552
let(:test_resource) { base_resource.merge(additional_parameters) }
15531553

15541554
before do
1555+
allow(Puppet::Pops::Types::PSensitiveType::Sensitive).to receive(:===).with(foo_password).and_return(true)
1556+
allow(Puppet::Pops::Types::PSensitiveType::Sensitive).to receive(:===).with(bar_password).and_return(true)
15551557
allow(foo_password).to receive(:unwrap).and_return('foo')
15561558
allow(bar_password).to receive(:unwrap).and_return('bar')
15571559
end
@@ -1790,7 +1792,10 @@
17901792
let(:variable_interpolated_param_hash) do
17911793
"$InvokeParams = @{Name = 'Foo'; Method = 'Get'; Property = @{credential = $SomeCredential}; ModuleName = 'PuppetDsc'}"
17921794
end
1793-
1795+
before do
1796+
allow(Puppet::Pops::Types::PSensitiveType::Sensitive).to receive(:===).with(password).and_return(true)
1797+
allow(password).to receive(:unwrap).and_return('bar')
1798+
end
17941799
it 'unwraps the credential hash and interpolates the appropriate variable' do
17951800
expect(password).to receive(:unwrap).and_return('FooPassword')
17961801
expect(provider).to receive(:interpolate_variables).with(formatted_param_hash).and_return(variable_interpolated_param_hash)

0 commit comments

Comments
 (0)