From 4549d064af8b1144cfd1e26ce2fac68f3dd2415d Mon Sep 17 00:00:00 2001 From: Jacob Zaval Date: Thu, 4 Apr 2024 14:41:32 -0700 Subject: [PATCH] fix user unit test --- spec/unit/resources/macos_user_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spec/unit/resources/macos_user_spec.rb b/spec/unit/resources/macos_user_spec.rb index 7552b7d..844a44f 100644 --- a/spec/unit/resources/macos_user_spec.rb +++ b/spec/unit/resources/macos_user_spec.rb @@ -68,6 +68,25 @@ describe 'macos_user with no password on machine without a password policy' do allow(provider).to receive_shell_out('/usr/sbin/sysadminctl', '-secureTokenStatus', 'cloudtest', stderr: 'Secure token is DISABLED for user cloudtest', exitstatus: 0) end + stubs_for_resource('execute[clear any existing password policies]') do |resource| + allow(resource).to receive_shell_out('pwpolicy getaccountpolicies', stdout: <<~PLIST + + + + + policyCategoryPasswordContent + + + policyContent + policyAttributePassword matches '.{8,}' + policyContentDescription + + + + + PLIST + ) + end end recipe do