Exemplo n.º 1
0
    def test_get_all_interfaces(self):
        '''
        Test if it return configs for all interfaces.
        '''
        ret = {
            'Ethernet': {
                '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_all_interfaces(), ret)
Exemplo n.º 2
0
    def test_get_all_interfaces(self):
        """
        Test if it return configs for all interfaces.
        """
        ret = {
            "Ethernet": {
                "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_all_interfaces(), ret)
Exemplo n.º 3
0
    def test_get_all_interfaces(self):
        """
        Test if it return configs for all interfaces.
        """
        ret = {
            "Ethernet": {
                "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_all_interfaces(), ret)