Esempio n. 1
0
    def test_get_interface(self):
        '''
        Test if it return the configuration of a network interface.
        '''
        ret = {
            'DHCP enabled':
            'Yes',
            'DNS servers configured through DHCP': ['1.2.3.4'],
            'Default Gateway':
            '1.2.3.1',
            'Gateway Metric':
            '0',
            'InterfaceMetric':
            '20',
            'Register with which suffix':
            'Primary only',
            'WINS servers configured through DHCP': ['None'],
            'ip_addrs': [{
                'IP Address': '1.2.3.74',
                'Netmask': '255.255.255.0',
                'Subnet': '1.2.3.0/24'
            }]
        }

        mock_cmd = MagicMock(return_value=ETHERNET_CONFIG)
        with patch.dict(win_ip.__salt__, {'cmd.run': mock_cmd}):
            self.assertDictEqual(win_ip.get_interface('Ethernet'), ret)
Esempio n. 2
0
    def test_get_interface(self):
        """
        Test if it return the configuration of a network interface.
        """
        ret = {
            "DHCP enabled":
            "Yes",
            "DNS servers configured through DHCP": ["1.2.3.4"],
            "Default Gateway":
            "1.2.3.1",
            "Gateway Metric":
            "0",
            "InterfaceMetric":
            "20",
            "Register with which suffix":
            "Primary only",
            "WINS servers configured through DHCP": ["None"],
            "ip_addrs": [{
                "IP Address": "1.2.3.74",
                "Netmask": "255.255.255.0",
                "Subnet": "1.2.3.0/24",
            }],
        }

        mock_cmd = MagicMock(return_value=ETHERNET_CONFIG)
        with patch.dict(win_ip.__salt__, {"cmd.run": mock_cmd}):
            self.assertDictEqual(win_ip.get_interface("Ethernet"), ret)
Esempio n. 3
0
    def test_get_interface(self):
        """
        Test if it return the configuration of a network interface.
        """
        ret = {
            "DHCP enabled": "Yes",
            "DNS servers configured through DHCP": "1.2.3.4",
            "Default Gateway": "1.2.3.1",
            "Gateway Metric": "0",
            "InterfaceMetric": "20",
            "Register with which suffix": "Primary only",
            "WINS servers configured through DHCP": "None",
            "ip_addrs": [{"IP Address": "1.2.3.74", "Netmask": "255.255.255.0", "Subnet": "1.2.3.0/24"}],
        }

        mock_cmd = MagicMock(return_value=ETHERNET_CONFIG)
        with patch.dict(win_ip.__salt__, {"cmd.run": mock_cmd}):
            self.assertDictEqual(win_ip.get_interface("Ethernet"), ret)