* Added support for alternate SSH ports in AsusWRT (#4832) * Always set the SSH port in SSH arguments * Removed whitespace * Adding port=22 to the mock calls * Changed config.get(CONF_PORT) to config[CONF_PORT] per feedback from @pvizeli
This commit is contained in:
1 parent
25408941de
commit
37a8035c54
2 files changed
+16
-7
No files matched your search
@@ -12,7 +12,7 @@ from homeassistant.components.device_tracker import (
|
||||
CONF_CONSIDER_HOME, CONF_TRACK_NEW)
|
||||
from homeassistant.components.device_tracker.asuswrt import (
|
||||
CONF_PROTOCOL, CONF_MODE, CONF_PUB_KEY, DOMAIN,
|
||||
PLATFORM_SCHEMA)
|
||||
CONF_PORT, PLATFORM_SCHEMA)
|
||||
from homeassistant.const import (CONF_PLATFORM, CONF_PASSWORD, CONF_USERNAME,
|
||||
CONF_HOST)
|
||||
|
||||
@@ -86,6 +86,7 @@ class TestComponentsDeviceTrackerASUSWRT(unittest.TestCase):
|
||||
|
||||
conf_dict[DOMAIN][CONF_MODE] = 'router'
|
||||
conf_dict[DOMAIN][CONF_PROTOCOL] = 'ssh'
|
||||
conf_dict[DOMAIN][CONF_PORT] = 22
|
||||
self.assertEqual(asuswrt_mock.call_count, 1)
|
||||
self.assertEqual(asuswrt_mock.call_args, mock.call(conf_dict[DOMAIN]))
|
||||
|
||||
@@ -111,6 +112,7 @@ class TestComponentsDeviceTrackerASUSWRT(unittest.TestCase):
|
||||
|
||||
conf_dict[DOMAIN][CONF_MODE] = 'router'
|
||||
conf_dict[DOMAIN][CONF_PROTOCOL] = 'ssh'
|
||||
conf_dict[DOMAIN][CONF_PORT] = 22
|
||||
self.assertEqual(asuswrt_mock.call_count, 1)
|
||||
self.assertEqual(asuswrt_mock.call_args, mock.call(conf_dict[DOMAIN]))
|
||||
|
||||
@@ -136,7 +138,7 @@ class TestComponentsDeviceTrackerASUSWRT(unittest.TestCase):
|
||||
self.assertEqual(ssh.login.call_count, 1)
|
||||
self.assertEqual(
|
||||
ssh.login.call_args,
|
||||
mock.call('fake_host', 'fake_user', ssh_key=FAKEFILE)
|
||||
mock.call('fake_host', 'fake_user', port=22, ssh_key=FAKEFILE)
|
||||
)
|
||||
|
||||
def test_ssh_login_with_password(self):
|
||||
@@ -161,7 +163,7 @@ class TestComponentsDeviceTrackerASUSWRT(unittest.TestCase):
|
||||
self.assertEqual(ssh.login.call_count, 1)
|
||||
self.assertEqual(
|
||||
ssh.login.call_args,
|
||||
mock.call('fake_host', 'fake_user', password='fake_pass')
|
||||
mock.call('fake_host', 'fake_user', password='fake_pass', port=22)
|
||||
)
|
||||
|
||||
def test_ssh_login_without_password_or_pubkey(self): \
|
||||
|
||||
Reference in new issue
Block a user