Beispiel #1
0
    def test_get_dns_servers(self):
        '''
        Test if it return a list of the configured DNS servers
        of the specified interface.
        '''
        with patch('salt.utils.winapi.Com', MagicMock()):
            self.assertListEqual(win_dns_client.get_dns_servers
                                 ('Local Area Connection'), ['10.1.1.10'])

            self.assertFalse(win_dns_client.get_dns_servers('Ethernet'))
Beispiel #2
0
    def test_get_dns_servers(self):
        '''
        Test if it return a list of the configured DNS servers
        of the specified interface.
        '''
        with patch('salt.utils.winapi.Com', MagicMock()):
            with patch.object(WMI, 'Win32_NetworkAdapter',
                              return_value=[Mockwmi()]):
                with patch.object(WMI, 'Win32_NetworkAdapterConfiguration',
                                  return_value=[Mockwmi()]):
                    self.assertListEqual(win_dns_client.get_dns_servers
                                         ('Local Area Connection'),
                                         ['10.1.1.10'])

                    self.assertFalse(win_dns_client.get_dns_servers('Ethernet'))
Beispiel #3
0
    def test_get_dns_servers(self):
        '''
        Test if it return a list of the configured DNS servers
        of the specified interface.
        '''
        with patch('salt.utils', Mockwinapi), \
                patch('salt.utils.winapi.Com', MagicMock()), \
                patch.object(self.WMI, 'Win32_NetworkAdapter',
                             return_value=[Mockwmi()]), \
                patch.object(self.WMI, 'Win32_NetworkAdapterConfiguration',
                             return_value=[Mockwmi()]):
            self.assertListEqual(
                win_dns_client.get_dns_servers('Local Area Connection'),
                ['10.1.1.10'])

            self.assertFalse(win_dns_client.get_dns_servers('Ethernet'))
    def test_get_dns_servers(self):
        """
        Test if it return a list of the configured DNS servers
        of the specified interface.
        """
        with patch("salt.utils.winapi.Com", MagicMock()), patch.object(
            self.WMI, "Win32_NetworkAdapter", return_value=[Mockwmi()]
        ), patch.object(
            self.WMI, "Win32_NetworkAdapterConfiguration", return_value=[Mockwmi()]
        ), patch.object(
            wmi, "WMI", Mock(return_value=self.WMI)
        ):
            self.assertListEqual(
                win_dns_client.get_dns_servers("Local Area Connection"), ["10.1.1.10"]
            )

            self.assertFalse(win_dns_client.get_dns_servers("Ethernet"))
def test_get_dns_servers():
    """
    Test if it return a list of the configured DNS servers
    of the specified interface.
    """
    WMI = Mock()
    with patch("salt.utils.winapi.Com", MagicMock()), patch.object(
            WMI, "Win32_NetworkAdapter",
            return_value=[Mockwmi()]), patch.object(
                WMI,
                "Win32_NetworkAdapterConfiguration",
                return_value=[Mockwmi()
                              ]), patch.object(wmi, "WMI",
                                               Mock(return_value=WMI)):
        assert win_dns_client.get_dns_servers("Local Area Connection") == [
            "10.1.1.10"
        ]

        assert not win_dns_client.get_dns_servers("Ethernet")