Module Expr Str ImportFrom alias ImportFrom alias ImportFrom alias alias ImportFrom alias ImportFrom alias alias alias alias Expr Call NameLoad Str ImportFrom alias TryExcept body Import alias Import alias Import alias ImportFrom alias Assign NameStore NameLoad handlers ExceptHandler type NameLoad body Assign NameStore NameLoad Assign AttributeStore NameLoad attr Dict ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword Str With Call AttributeLoad NameLoad attr NameLoad Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword Str With Call AttributeLoad NameLoad attr NameLoad Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str decorator_list Call NameLoad UnaryOpNot NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword Str With Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Dict Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr ListLoad Str Str Str Str keyword NameLoad decorator_list Call NameLoad UnaryOpNot NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword Str With Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Dict Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num keyword NameLoad Str Expr Call AttributeLoad NameLoad attr ListLoad Str Str Str Str keyword NameLoad decorator_list Call NameLoad UnaryOpNot NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword Str With Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Dict Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num keyword NameLoad Str Expr Call AttributeLoad NameLoad attr ListLoad Str Str Str Str keyword NameLoad decorator_list Call NameLoad UnaryOpNot NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword Str Assign NameStore Call NameLoad keyword Str With Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Dict Str NameLoad body With Call NameLoad Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr keyword NameLoad Str Expr Call AttributeLoad NameLoad attr ListLoad Str Str Str Str keyword NameLoad Expr Call AttributeLoad NameLoad attr Num decorator_list Call NameLoad UnaryOpNot NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword Str With Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Dict Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str decorator_list Call NameLoad UnaryOpNot NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword Str With Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Dict Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str decorator_list Call NameLoad UnaryOpNot NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword ListLoad Dict Str Str Dict Str Str NameLoad Dict Str Dict Str Str With Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Dict Str NameLoad body Assign NameStore Call NameLoad keyword Str With Call AttributeLoad NameLoad attr NameLoad Str NameLoad body Assign NameStore Call NameLoad keyword NameLoad With Call AttributeLoad NameLoad attr NameLoad Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Dict Str Dict Str Str Str NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str decorator_list Call NameLoad UnaryOpNot NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword Str With Call AttributeLoad NameLoad attr NameLoad Str NameLoad body Assign NameStore Call NameLoad keyword ListLoad Str Str With Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Dict Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str decorator_list Call NameLoad UnaryOpNot NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword ListLoad Str Str With Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Dict Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr decorator_list Call NameLoad UnaryOpNot NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword NameLoad With Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Dict Str NameLoad body Assign NameStore Call NameLoad keyword Str With Call AttributeLoad NameLoad attr NameLoad Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Dict Str Str decorator_list Call NameLoad UnaryOpNot NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword ListLoad Str Str With Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Dict Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr decorator_list Call NameLoad UnaryOpNot NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword ListLoad Dict Str NameLoad Dict Str NameLoad With Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Dict Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Str Str Dict Str Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Str Str decorator_list Call NameLoad UnaryOpNot NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr TryExcept body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad handlers ExceptHandler type NameLoad body Import alias Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword ListLoad NameLoad NameLoad With Call AttributeLoad NameLoad attr NameLoad Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Assign NameStore Call NameLoad keyword NameLoad With Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Dict Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str decorator_list Call NameLoad UnaryOpNot NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword ListLoad NameLoad NameLoad With Call AttributeLoad NameLoad attr NameLoad Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Assign NameStore Call NameLoad keyword NameLoad With Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Dict Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str decorator_list Call NameLoad UnaryOpNot NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword NameLoad With Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Dict Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword NameLoad With Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Dict Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword Str Assign NameStore Call NameLoad keyword Str With Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Dict Str NameLoad body With Call AttributeLoad NameLoad attr NameLoad Str NameLoad body Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr keyword Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword Str With Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Dict Str NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Str Expr Call AttributeLoad NameLoad attr keyword Str decorator_list decorator_list Call NameLoad NameLoad NameLoad If CompareEq NameLoad Str body ImportFrom alias Expr Call NameLoad NameLoad keyword NameLoad
N/A N/A 
    :codeauthor: :email:`Rahul Handay <rahulha@saltstack.com>`
 __future__ absolute_import datetime datetime salttesting TestCase skipIf salttesting.helpers ensure_in_syspath salttesting.mock MagicMock patch NO_MOCK NO_MOCK_REASON N/A N/A ensure_in_syspath ../../ salt.modules win_system N/A N/A N/A win32net N/A win32api N/A pywintypes ctypes windll N/A HAS_WIN32NET_MODS True N/A N/A N/A ImportError N/A N/A HAS_WIN32NET_MODS False N/A N/A win_system __salt__ N/A WinSystemTestCase N/A TestCase N/A N/A 
        Test cases for salt.modules.win_system
     test_halt N/A N/A self N/A N/A N/A 
            Test to halt a running system
         N/A mock N/A MagicMock return_value salt N/A N/A N/A patch object win_system shutdown mock N/A N/A N/A N/A self assertEqual N/A N/A win_system halt salt N/A test_init N/A N/A self N/A N/A N/A 
            Test to change the system runlevel on sysV compatible systems
         N/A N/A N/A self assertEqual N/A N/A win_system init 3 Not implemented on Windows at this time. N/A test_poweroff N/A N/A self N/A N/A N/A 
            Test to poweroff a running system
         N/A mock N/A MagicMock return_value salt N/A N/A N/A patch object win_system shutdown mock N/A N/A N/A N/A self assertEqual N/A N/A win_system poweroff salt N/A N/A skipIf N/A HAS_WIN32NET_MODS this test needs the w32net library test_reboot N/A N/A self N/A N/A N/A 
            Test to reboot the system
         N/A mock N/A MagicMock return_value salt N/A N/A N/A patch dict N/A win_system __salt__ N/A cmd.run mock N/A N/A N/A N/A self assertEqual N/A N/A win_system reboot salt N/A N/A N/A mock assert_called_once_with N/A shutdown /r /t 300 python_shell False N/A N/A skipIf N/A HAS_WIN32NET_MODS this test needs the w32net library test_reboot_with_timeout_in_minutes N/A N/A self N/A N/A N/A 
            Test to reboot the system with a timeout
         N/A mock N/A MagicMock return_value salt N/A N/A N/A patch dict N/A win_system __salt__ N/A cmd.run mock N/A N/A N/A N/A self assertEqual N/A N/A win_system reboot 5 in_seconds False salt N/A N/A N/A mock assert_called_once_with N/A shutdown /r /t 300 python_shell False N/A N/A skipIf N/A HAS_WIN32NET_MODS this test needs the w32net library test_reboot_with_timeout_in_seconds N/A N/A self N/A N/A N/A 
            Test to reboot the system with a timeout
         N/A mock N/A MagicMock return_value salt N/A N/A N/A patch dict N/A win_system __salt__ N/A cmd.run mock N/A N/A N/A N/A self assertEqual N/A N/A win_system reboot 5 in_seconds True salt N/A N/A N/A mock assert_called_once_with N/A shutdown /r /t 5 python_shell False N/A N/A skipIf N/A HAS_WIN32NET_MODS this test needs the w32net library test_reboot_with_wait N/A N/A self N/A N/A N/A 
            Test to reboot the system with a timeout and
            wait for it to finish
         N/A mock N/A MagicMock return_value salt N/A sleep_mock N/A MagicMock return_value salt N/A N/A N/A patch dict N/A win_system __salt__ N/A cmd.run mock N/A N/A N/A patch time.sleep sleep_mock N/A N/A N/A N/A self assertEqual N/A N/A win_system reboot wait_for_reboot True salt N/A N/A N/A mock assert_called_once_with N/A shutdown /r /t 300 python_shell False N/A N/A N/A sleep_mock assert_called_once_with 330 N/A N/A skipIf N/A HAS_WIN32NET_MODS this test needs the w32net library test_shutdown N/A N/A self N/A N/A N/A 
            Test to shutdown a running system
         N/A mock N/A MagicMock return_value salt N/A N/A N/A patch dict N/A win_system __salt__ N/A cmd.run mock N/A N/A N/A N/A self assertEqual N/A N/A win_system shutdown salt N/A N/A skipIf N/A HAS_WIN32NET_MODS this test needs the w32net library test_shutdown_hard N/A N/A self N/A N/A N/A 
            Test to shutdown a running system with no timeout or warning
         N/A mock N/A MagicMock return_value salt N/A N/A N/A patch dict N/A win_system __salt__ N/A cmd.run mock N/A N/A N/A N/A self assertEqual N/A N/A win_system shutdown_hard salt N/A N/A skipIf N/A HAS_WIN32NET_MODS this test needs the w32net library test_set_computer_name N/A N/A self N/A N/A N/A 
            Test to set the Windows computer name
         N/A mock N/A MagicMock side_effect N/A N/A Computer Name ReturnValue = 0; N/A Current True N/A Computer Name N/A Current salt N/A N/A N/A patch dict N/A win_system __salt__ N/A cmd.run mock N/A N/A mock N/A MagicMock return_value salt N/A N/A N/A patch object win_system get_computer_name mock N/A N/A mock N/A MagicMock return_value True N/A N/A N/A patch object win_system get_pending_computer_name mock N/A N/A N/A N/A self assertDictEqual N/A N/A win_system set_computer_name salt N/A Computer Name N/A Current Pending salt True N/A N/A N/A self assertFalse N/A N/A win_system set_computer_name salt N/A N/A skipIf N/A HAS_WIN32NET_MODS this test needs the w32net library test_get_pending_computer_name N/A N/A self N/A N/A N/A 
            Test to get a pending computer name.
         N/A mock N/A MagicMock return_value salt N/A N/A N/A patch object win_system get_computer_name mock N/A N/A mock N/A MagicMock side_effect N/A salt0 ComputerName REG_SZ (salt) N/A N/A N/A patch dict N/A win_system __salt__ N/A cmd.run mock N/A N/A N/A N/A self assertFalse N/A N/A win_system get_pending_computer_name N/A N/A N/A self assertEqual N/A N/A win_system get_pending_computer_name (salt) N/A N/A skipIf N/A HAS_WIN32NET_MODS this test needs the w32net library test_get_computer_name N/A N/A self N/A N/A N/A 
            Test to get the Windows computer name
         N/A mock N/A MagicMock side_effect N/A Server Name Salt Salt N/A N/A N/A patch dict N/A win_system __salt__ N/A cmd.run mock N/A N/A N/A N/A self assertEqual N/A N/A win_system get_computer_name Salt N/A N/A N/A self assertFalse N/A N/A win_system get_computer_name N/A N/A skipIf N/A HAS_WIN32NET_MODS this test needs the w32net library test_set_computer_desc N/A N/A self N/A N/A N/A 
            Test to set the Windows computer description
         N/A mock N/A MagicMock return_value True N/A N/A N/A patch dict N/A win_system __salt__ N/A cmd.run mock N/A N/A mock N/A MagicMock return_value Salt's comp N/A N/A N/A patch object win_system get_computer_desc mock N/A N/A N/A N/A self assertDictEqual N/A N/A win_system set_computer_desc Salt's comp N/A Computer Description Salt's comp N/A N/A skipIf N/A HAS_WIN32NET_MODS this test needs the w32net library test_get_computer_desc N/A N/A self N/A N/A N/A 
            Test to get the Windows computer description
         N/A mock N/A MagicMock side_effect N/A Server Comment Salt Salt N/A N/A N/A patch dict N/A win_system __salt__ N/A cmd.run mock N/A N/A N/A N/A self assertEqual N/A N/A win_system get_computer_desc Salt N/A N/A N/A self assertFalse N/A N/A win_system get_computer_desc N/A N/A skipIf N/A HAS_WIN32NET_MODS this test needs the w32net library test_join_domain N/A N/A self N/A N/A N/A 
            Test to join a computer to an Active Directory domain
         N/A mock N/A MagicMock side_effect N/A N/A ReturnValue = 0; True N/A Salt True N/A N/A N/A patch dict N/A win_system __salt__ N/A cmd.run mock N/A N/A N/A N/A self assertDictEqual N/A N/A win_system join_domain saltstack salt salt@123 N/A Domain saltstack N/A N/A N/A self assertFalse N/A N/A win_system join_domain saltstack salt salt@123 N/A N/A skipIf N/A HAS_WIN32NET_MODS this test needs w32net and other windows libraries test_get_system_time N/A N/A self N/A N/A N/A 
            Test to get system time
         N/A tm N/A N/A datetime strftime N/A N/A datetime now %I:%M %p N/A win_tm N/A N/A win_system get_system_time N/A N/A N/A N/A N/A self assertEqual win_tm tm N/A N/A N/A AssertionError N/A N/A re N/A N/A N/A self assertTrue N/A N/A re search ^\d{2}:\d{2} \w{2}$ win_tm N/A test_set_system_time N/A N/A self N/A N/A N/A 
            Test to set system time
         N/A mock N/A MagicMock side_effect N/A False True N/A N/A N/A patch object win_system _validate_time mock N/A N/A N/A N/A self assertFalse N/A N/A win_system set_system_time 11:31:15 AM N/A mock N/A MagicMock return_value True N/A N/A N/A patch dict N/A win_system __salt__ N/A cmd.retcode mock N/A N/A N/A N/A self assertFalse N/A N/A win_system set_system_time 11:31:15 AM N/A N/A skipIf N/A HAS_WIN32NET_MODS this test needs the w32net library test_get_system_date N/A N/A self N/A N/A N/A 
            Test to get system date
         N/A date N/A N/A datetime strftime N/A N/A datetime now %a %m/%d/%Y N/A N/A N/A self assertEqual N/A N/A win_system get_system_date date N/A test_set_system_date N/A N/A self N/A N/A N/A 
            Test to set system date
         N/A mock N/A MagicMock side_effect N/A False True N/A N/A N/A patch object win_system _validate_date mock N/A N/A N/A N/A self assertFalse N/A N/A win_system set_system_date 03-28-13 N/A mock N/A MagicMock return_value True N/A N/A N/A patch dict N/A win_system __salt__ N/A cmd.retcode mock N/A N/A N/A N/A self assertFalse N/A N/A win_system set_system_date 03-28-13 N/A N/A skipIf N/A HAS_WIN32NET_MODS this test needs the w32net library test_start_time_service N/A N/A self N/A N/A N/A 
            Test to start the Windows time service
         N/A mock N/A MagicMock return_value True N/A N/A N/A patch dict N/A win_system __salt__ N/A service.start mock N/A N/A N/A N/A self assertTrue N/A N/A win_system start_time_service N/A test_stop_time_service N/A N/A self N/A N/A N/A 
            Test to stop the windows time service
         N/A mock N/A MagicMock return_value True N/A N/A N/A patch dict N/A win_system __salt__ N/A service.stop mock N/A N/A N/A N/A self assertTrue N/A N/A win_system stop_time_service N/A test_set_hostname N/A N/A self N/A N/A N/A 
            Test setting a new hostname
         N/A cmd_run_mock N/A MagicMock return_value Method execution successful. N/A get_hostname N/A MagicMock return_value MINION N/A N/A N/A patch dict N/A win_system __salt__ N/A cmd.run cmd_run_mock N/A N/A N/A N/A patch object win_system get_hostname get_hostname N/A N/A N/A N/A win_system set_hostname NEW N/A N/A N/A cmd_run_mock assert_called_once_with cmd wmic computersystem where name='MINION' call rename name='NEW' N/A test_get_hostname N/A N/A self N/A N/A N/A 
            Test setting a new hostname
         N/A cmd_run_mock N/A MagicMock return_value Name
MINION N/A N/A N/A patch dict N/A win_system __salt__ N/A cmd.run cmd_run_mock N/A N/A ret N/A N/A win_system get_hostname N/A N/A N/A self assertEqual ret MINION N/A N/A N/A cmd_run_mock assert_called_once_with cmd wmic computersystem get name N/A N/A N/A skipIf NO_MOCK NO_MOCK_REASON N/A N/A __name__ __main__ N/A integration run_tests N/A N/A run_tests WinSystemTestCase needs_daemon False