def test_get_hostname(self):
     '''
         Test setting a new hostname
     '''
     cmd_run_mock = MagicMock(return_value="Name\nMINION")
     with patch.dict(win_system.__salt__, {'cmd.run': cmd_run_mock}):
         ret = win_system.get_hostname()
         self.assertEqual(ret, "MINION")
     cmd_run_mock.assert_called_once_with(cmd="wmic computersystem get name")
Exemple #2
0
 def test_get_hostname(self):
     '''
         Test setting a new hostname
     '''
     cmd_run_mock = MagicMock(return_value="MINION")
     with patch.dict(win_system.__salt__, {'cmd.run': cmd_run_mock}):
         ret = win_system.get_hostname()
         self.assertEqual(ret, "MINION")
     cmd_run_mock.assert_called_once_with(cmd="hostname")
Exemple #3
0
        Test set_domain_workgroup
        '''
        with patch('salt.utils', Mockwinapi), \
                patch.object(wmi, 'WMI', Mock(return_value=self.WMI)), \
                patch('salt.utils.winapi.Com', MagicMock()), \
                patch.object(self.WMI, 'Win32_ComputerSystem',
                          return_value=[MockWMI_ComputerSystem()]):
            self.assertTrue(win_system.set_domain_workgroup('test'))

    def test_get_hostname(self):
        '''
            Test getting a new hostname
        '''
        cmd_run_mock = MagicMock(return_value="MINION")
        with patch.dict(win_system.__salt__, {"cmd.run": cmd_run_mock}):
            ret = win_system.get_hostname()
            self.assertEqual(ret, "MINION")
        cmd_run_mock.assert_called_once_with(cmd="hostname")

    @skipIf(not win_system.HAS_WIN32NET_MODS, "Missing win32 libraries")
    def test_get_system_info(self):
        fields = ['bios_caption', 'bios_description', 'bios_details',
                  'bios_manufacturer', 'bios_version', 'bootup_state',
                  'caption', 'chassis_bootup_state', 'chassis_sku_number',
                  'description', 'dns_hostname', 'domain', 'domain_role',
                  'hardware_manufacturer', 'hardware_model', 'hardware_serial',
                  'install_date', 'last_boot', 'name',
                  'network_server_mode_enabled', 'organization',
                  'os_architecture', 'os_manufacturer', 'os_name', 'os_type',
                  'os_version', 'part_of_domain', 'pc_system_type',
                  'power_state', 'primary', 'processor_cores',