Reinstated Port option for Junos Proxy with tests

This commit is contained in:
David Murphy 2021-06-08 17:39:07 -06:00 committed by Megan Wilhite
parent cb1917b0f4
commit 91e12297a7
3 changed files with 23 additions and 2 deletions

1
changelog/60340.fixed Normal file
View file

@ -0,0 +1 @@
Port option reinstated for Junos Proxy (accidentally removed)

View file

@ -110,6 +110,7 @@ def init(opts):
"username",
"password",
"passwd",
"port",
"gather_facts",
"mode",
"baud",

View file

@ -2,7 +2,7 @@ import io
import salt.proxy.junos as junos
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import patch
from tests.support.mock import ANY, patch
from tests.support.unit import TestCase, skipIf
try:
@ -21,12 +21,31 @@ class JunosProxyTestCase(TestCase, LoaderModuleMockMixin):
return {junos: {"DETAILS": {}, "__pillar__": {}}}
def setUp(self):
self.opts = {"proxy": {"username": "xxxx", "password]": "xxx", "host": "junos"}}
self.opts = {
"proxy": {
"username": "xxxx",
"password]": "xxx",
"host": "junos",
"port": "960",
}
}
@patch("ncclient.manager.connect")
def test_init(self, mock_connect):
junos.init(self.opts)
self.assertTrue(junos.thisproxy.get("initialized"))
mock_connect.assert_called_with(
allow_agent=True,
device_params={"name": "junos", "local": False, "use_filter": False},
host="junos",
hostkey_verify=False,
key_filename=None,
password=None,
port="960",
sock_fd=None,
ssh_config=ANY,
username="xxxx",
)
@patch("ncclient.manager.connect")
def test_init_err(self, mock_connect):