def validate(self, task): """Validate the driver_info in the node Check if the driver_info contains correct required fields :param task: a TaskManager instance contains the target node :raises: MissingParameterValue if any required parameters are missing. :raises: InvalidParameterValue if any parameters have invalid values. """ # FIXME(lintan): validate hangs if unable to reach AMT, so dont # connect to the node until bug 1314961 is resolved. amt_common.parse_driver_info(task.node)
def validate(self, task): """Validate the driver_info in the node. Check if the driver_info contains correct required fields :param task: a TaskManager instance contains the target node. :raises: MissingParameterValue if any required parameters are missing. :raises: InvalidParameterValue if any parameters have invalid values. """ # FIXME(lintan): validate hangs if unable to reach AMT, so dont # connect to the node until bug 1314961 is resolved. amt_common.parse_driver_info(task.node)
def test_parse_driver_info(self): info = amt_common.parse_driver_info(self.node) self.assertIsNotNone(info.get('address')) self.assertIsNotNone(info.get('username')) self.assertIsNotNone(info.get('password')) self.assertIsNotNone(info.get('protocol')) self.assertIsNotNone(info.get('uuid'))
def test_parse_driver_info(self): info = amt_common.parse_driver_info(self.node) self.assertIsNotNone(info.get("address")) self.assertIsNotNone(info.get("username")) self.assertIsNotNone(info.get("password")) self.assertIsNotNone(info.get("protocol")) self.assertIsNotNone(info.get("uuid"))
def test_parse_driver_info(self): info = amt_common.parse_driver_info(self.node) self.assertEqual(b'1.2.3.4', info['address']) self.assertEqual(b'admin', info['username']) self.assertEqual(b'fake', info['password']) self.assertEqual(INFO_DICT['amt_protocol'], info['protocol']) self.assertEqual('1be26c0b-03f2-4d2e-ae87-c02d7f33c123', info['uuid'])
def test_get_wsman_client(self, mock_client): info = amt_common.parse_driver_info(self.node) amt_common.get_wsman_client(self.node) options = {'address': info['address'], 'protocol': info['protocol'], 'username': info['username'], 'password': info['password']} mock_client.assert_called_once_with(**options)
def test_get_wsman_client(self, mock_client): info = amt_common.parse_driver_info(self.node) amt_common.get_wsman_client(self.node) options = { "address": info["address"], "protocol": info["protocol"], "username": info["username"], "password": info["password"], } mock_client.assert_called_once_with(**options)
def test_parse_driver_info_missing_protocol(self): del self.node.driver_info["amt_protocol"] info = amt_common.parse_driver_info(self.node) self.assertEqual("http", info.get("protocol"))
def test_parse_driver_info_missing_protocol(self): del self.node.driver_info['amt_protocol'] info = amt_common.parse_driver_info(self.node) self.assertEqual('http', info.get('protocol'))
def test_parse_driver_info_missing_protocol(self): del self.node.driver_info['amt_protocol'] info = amt_common.parse_driver_info(self.node) self.assertEqual('http', info['protocol'])