<s> from __future__ import absolute_import <EOL> from salt . modules import mac_defaults as macdefaults <EOL> from salttesting import TestCase <EOL> from salttesting . helpers import ensure_in_syspath <EOL> from salttesting . mock import ( <EOL> MagicMock , <EOL> patch <EOL> ) <EOL> ensure_in_syspath ( '<STR_LIT>' ) <EOL> macdefaults . __salt__ = { } <EOL> class MacDefaultsTestCase ( TestCase ) : <EOL> def test_write_default ( self ) : <EOL> '''<STR_LIT>''' <EOL> mock = MagicMock ( ) <EOL> with patch . dict ( macdefaults . __salt__ , { '<STR_LIT>' : mock } ) : <EOL> macdefaults . write ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> mock . assert_called_once_with ( '<STR_LIT>' , <EOL> runas = None ) <EOL> def test_write_with_user ( self ) : <EOL> '''<STR_LIT>''' <EOL> mock = MagicMock ( ) <EOL> with patch . dict ( macdefaults . __salt__ , { '<STR_LIT>' : mock } ) : <EOL> macdefaults . write ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , user = "<STR_LIT>" ) <EOL> mock . assert_called_once_with ( '<STR_LIT>' , <EOL> runas = "<STR_LIT>" ) <EOL> def test_write_default_boolean ( self ) : <EOL> '''<STR_LIT>''' <EOL> mock = MagicMock ( ) <EOL> with patch . dict ( macdefaults . __salt__ , { '<STR_LIT>' : mock } ) : <EOL> macdefaults . write ( '<STR_LIT>' , '<STR_LIT>' , True , type = "<STR_LIT>" ) <EOL> mock . assert_called_once_with ( '<STR_LIT>' , <EOL> runas = None ) <EOL> def test_read_default ( self ) : <EOL> '''<STR_LIT>''' <EOL> mock = MagicMock ( ) <EOL> with patch . dict ( macdefaults . __salt__ , { '<STR_LIT>' : mock } ) : <EOL> macdefaults . read ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> mock . assert_called_once_with ( '<STR_LIT>' , runas = None ) <EOL> def test_read_default_with_user ( self ) : <EOL> '''<STR_LIT>''' <EOL> mock = MagicMock ( ) <EOL> with patch . dict ( macdefaults . __salt__ , { '<STR_LIT>' : mock } ) : <EOL> macdefaults . read ( '<STR_LIT>' , '<STR_LIT>' , user = "<STR_LIT>" ) <EOL> mock . assert_called_once_with ( '<STR_LIT>' , runas = "<STR_LIT>" ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> from integration import run_tests <EOL> run_tests ( MacDefaultsTestCase , needs_daemon = False ) </s>
