コード例 #1
0
ファイル: test_ilo.py プロジェクト: mamh-mixed/saltstack-salt
    def test_configure_network(self):
        """
        Test if it configure Network Interface
        """
        with patch(
                "salt.modules.ilo.__execute_cmd",
                MagicMock(return_value={"Configure_Network": {}}),
        ):
            ret = {
                "Network Settings": {
                    "IP_ADDRESS": {
                        "VALUE": "10.0.0.10"
                    },
                    "SUBNET_MASK": {
                        "VALUE": "255.255.255.0"
                    },
                    "GATEWAY_IP_ADDRESS": {
                        "VALUE": "10.0.0.1"
                    },
                }
            }
            with patch.object(ilo, "network", return_value=ret):
                self.assertTrue(
                    ilo.configure_network("10.0.0.10", "255.255.255.0",
                                          "10.0.0.1"))

            with patch.object(ilo, "network", return_value=ret):
                with patch.object(ilo,
                                  "__execute_cmd",
                                  return_value={"Network Settings": {}}):
                    self.assertDictEqual(
                        ilo.configure_network("10.0.0.100", "255.255.255.10",
                                              "10.0.0.10"),
                        {"Network Settings": {}},
                    )
コード例 #2
0
ファイル: test_ilo.py プロジェクト: morinap/salt-1
    def test_configure_network(self):
        '''
        Test if it configure Network Interface
        '''
        with patch('salt.modules.ilo.__execute_cmd',
                   MagicMock(return_value={'Configure_Network': {}})):
            ret = {
                'Network Settings': {
                    'IP_ADDRESS': {
                        'VALUE': '10.0.0.10'
                    },
                    'SUBNET_MASK': {
                        'VALUE': '255.255.255.0'
                    },
                    'GATEWAY_IP_ADDRESS': {
                        'VALUE': '10.0.0.1'
                    }
                }
            }
            with patch.object(ilo, 'network', return_value=ret):
                self.assertTrue(
                    ilo.configure_network('10.0.0.10', '255.255.255.0',
                                          '10.0.0.1'))

            with patch.object(ilo, 'network', return_value=ret):
                with patch.object(ilo,
                                  '__execute_cmd',
                                  return_value={'Network Settings': {}}):
                    self.assertDictEqual(
                        ilo.configure_network('10.0.0.100', '255.255.255.10',
                                              '10.0.0.10'),
                        {'Network Settings': {}})
コード例 #3
0
ファイル: ilo_test.py プロジェクト: DaveQB/salt
    def test_configure_network(self):
        '''
        Test if it configure Network Interface
        '''
        ret = {'Network Settings':
               {'IP_ADDRESS': {'VALUE': '10.0.0.10'},
                'SUBNET_MASK': {'VALUE': '255.255.255.0'},
                'GATEWAY_IP_ADDRESS': {'VALUE': '10.0.0.1'}}}
        with patch.object(ilo, 'network', return_value=ret):
            self.assertTrue(ilo.configure_network('10.0.0.10',
                                                  '255.255.255.0', '10.0.0.1'))

        with patch.object(ilo, 'network', return_value=ret):
            with patch.object(ilo, '__execute_cmd',
                              return_value={'Network Settings': {}}):
                self.assertDictEqual(ilo.configure_network('10.0.0.100',
                                                           '255.255.255.10',
                                                           '10.0.0.10'),
                                     {'Network Settings': {}})