コード例 #1
0
 def test_write_default(self):
     '''
         Test writing a default setting
     '''
     mock = MagicMock()
     with patch.dict(macdefaults.__salt__, {'cmd.run_all': mock}):
         macdefaults.write('com.apple.CrashReporter', 'DialogType',
                           'Server')
         mock.assert_called_once_with(
             'defaults write "com.apple.CrashReporter" "DialogType" -string "Server"',
             runas=None)
コード例 #2
0
 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,
         )
コード例 #3
0
def test_write_default():
    """
    Test writing a default setting
    """
    mock = MagicMock()
    with patch.dict(macdefaults.__salt__, {"cmd.run_all": mock}):
        macdefaults.write("com.apple.CrashReporter", "DialogType", "Server")
        mock.assert_called_once_with(
            'defaults write "com.apple.CrashReporter" "DialogType" -string "Server"',
            runas=None,
        )
コード例 #4
0
 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)
コード例 #5
0
 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",
         )