@patch('os.path.isfile', MagicMock(return_value=False))
    def test_persist_no_conf_failure(self):
        with patch('salt.utils.fopen', mock_open()) as m_open:
            m_open.side_effect = IOError(13, 'Permission denied', '/file')
            self.assertRaises(CommandExecutionError,
                              mac_sysctl.persist,
                              'net.inet.icmp.icmplim',
                              50, config=None)
Tests adding of config file failure
dataset/ETHPy150Open saltstack/salt/tests/unit/modules/mac_sysctl_test.py/DarwinSysctlTestCase.test_persist_no_conf_failure