<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import <EOL> from salttesting import skipIf , TestCase <EOL> from salttesting . mock import ( <EOL> NO_MOCK , <EOL> NO_MOCK_REASON , <EOL> MagicMock , <EOL> patch ) <EOL> from salttesting . helpers import ensure_in_syspath <EOL> ensure_in_syspath ( '<STR_LIT>' ) <EOL> from salt . modules import system <EOL> system . __salt__ = { } <EOL> @ skipIf ( NO_MOCK , NO_MOCK_REASON ) <EOL> class SystemTestCase ( TestCase ) : <EOL> '''<STR_LIT>''' <EOL> def test_halt ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( system . __salt__ , <EOL> { '<STR_LIT>' : MagicMock ( return_value = '<STR_LIT:A>' ) } ) : <EOL> self . assertEqual ( system . halt ( ) , '<STR_LIT:A>' ) <EOL> def test_init ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( system . __salt__ , <EOL> { '<STR_LIT>' : MagicMock ( return_value = '<STR_LIT:A>' ) } ) : <EOL> self . assertEqual ( system . init ( '<STR_LIT:r>' ) , '<STR_LIT:A>' ) <EOL> def test_poweroff ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( system . __salt__ , <EOL> { '<STR_LIT>' : MagicMock ( return_value = '<STR_LIT:A>' ) } ) : <EOL> self . assertEqual ( system . poweroff ( ) , '<STR_LIT:A>' ) <EOL> @ patch . dict ( system . __salt__ , { '<STR_LIT>' : MagicMock ( return_value = '<STR_LIT:A>' ) } ) <EOL> def test_reboot ( self ) : <EOL> '''<STR_LIT>''' <EOL> self . assertEqual ( system . reboot ( ) , '<STR_LIT:A>' ) <EOL> system . __salt__ [ '<STR_LIT>' ] . assert_called_with ( <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , python_shell = False ) <EOL> @ patch . dict ( system . __salt__ , { '<STR_LIT>' : MagicMock ( return_value = '<STR_LIT:A>' ) } ) <EOL> def test_reboot_with_delay ( self ) : <EOL> '''<STR_LIT>''' <EOL> self . assertEqual ( system . reboot ( at_time = <NUM_LIT:5> ) , '<STR_LIT:A>' ) <EOL> system . __salt__ [ '<STR_LIT>' ] . assert_called_with ( <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:5>' ] , python_shell = False ) <EOL> def test_shutdown ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . dict ( system . __salt__ , <EOL> { '<STR_LIT>' : MagicMock ( return_value = '<STR_LIT:A>' ) } ) : <EOL> self . assertEqual ( system . shutdown ( ) , '<STR_LIT:A>' ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> from integration import run_tests <EOL> run_tests ( SystemTestCase , needs_daemon = False ) </s>
