def test_write_set(self):
        expected = {
            'changes': {},
            'comment': 'com.apple.CrashReporter DialogType is already set to Server',
            'name': 'DialogType',
            'result': True
        }

        read_mock = MagicMock(return_value='Server')
        write_mock = MagicMock(return_value={'retcode': 0})
        with patch.dict(macdefaults.__salt__, {'macdefaults.read': read_mock,
                                               'macdefaults.write': write_mock}):
            out = macdefaults.write('DialogType', 'com.apple.CrashReporter', 'Server')
            read_mock.assert_called_once_with('com.apple.CrashReporter', 'DialogType', None)
            assert not write_mock.called
            self.assertEqual(out, expected)
Test writing a default setting that is already set
dataset/ETHPy150Open saltstack/salt/tests/unit/states/mac_defaults_test.py/MacDefaultsTestCase.test_write_set