def test__nxapi_request_ssh_return(self): """ UT: nxos module:_nxapi_request method - CONNECTION == 'ssh' """ commands = "show version" with patch("salt.proxy.nxos.CONNECTION", "ssh"): result = nxos_proxy._nxapi_request(commands) self.assertEqual("_nxapi_request is not available for ssh proxy", result)
def test__nxapi_request_connect(self): """ UT: nxos module:_nxapi_request method """ commands = "show version" nxapi_request = create_autospec(nxos_utils.nxapi_request, return_value="data") with patch("salt.proxy.nxos.DEVICE_DETAILS", {"conn_args": { "arg1": None }}): with patch("salt.proxy.nxos.__utils__", {"nxos.nxapi_request": nxapi_request}): result = nxos_proxy._nxapi_request(commands) self.assertEqual("data", result) nxapi_request.assert_called_with(commands, method="cli_conf", arg1=None)