def test_write_default_boolean(self): ''' Test writing a default setting ''' mock = MagicMock() with patch.dict(macdefaults.__salt__, {'cmd.run_all': mock}): macdefaults.write('com.apple.CrashReporter', 'Crash', True, type="boolean") mock.assert_called_once_with('defaults write "com.apple.CrashReporter" "Crash" -boolean "TRUE"', runas=None)
def test_write_with_user(self): ''' Test writing a default setting with a specific user ''' mock = MagicMock() with patch.dict(macdefaults.__salt__, {'cmd.run_all': mock}): macdefaults.write('com.apple.CrashReporter', 'DialogType', 'Server', user="******") mock.assert_called_once_with('defaults write "com.apple.CrashReporter" "DialogType" -string "Server"', runas="frank")