summaryrefslogtreecommitdiffhomepage
path: root/tests/test_client.py
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2019-06-21 18:57:55 -0400
committerJeff Forcier <jeff@bitprophet.org>2019-06-21 18:57:55 -0400
commitdceaa61d44b9baf68e8f89f1890b424906446f38 (patch)
tree143b454e8a0ea45b0371007b0d4fa7847743c5ea /tests/test_client.py
parent203dab26e659fb81f8a303e42d6c5b86118a1376 (diff)
Client->Transport for disable_algorithms
Diffstat (limited to 'tests/test_client.py')
-rw-r--r--tests/test_client.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_client.py b/tests/test_client.py
index 153106e8..f40c38c1 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -34,6 +34,7 @@ import weakref
from tempfile import mkstemp
from pytest_relaxed import raises
+from mock import patch, Mock
import paramiko
from paramiko import SSHClient
@@ -654,6 +655,22 @@ class SSHClientTest(ClientTest):
client.set_missing_host_key_policy(paramiko.AutoAddPolicy)
assert isinstance(client._policy, paramiko.AutoAddPolicy)
+ @patch("paramiko.client.Transport")
+ def test_disable_algorithms_defaults_to_None(self, Transport):
+ SSHClient().connect("host", sock=Mock(), password="no")
+ assert Transport.call_args[1]["disable_algorithms"] is None
+
+ @patch("paramiko.client.Transport")
+ def test_disable_algorithms_passed_directly_if_given(self, Transport):
+ SSHClient().connect(
+ "host",
+ sock=Mock(),
+ password="no",
+ disable_algorithms={"keys": ["ssh-dss"]},
+ )
+ call_arg = Transport.call_args[1]["disable_algorithms"]
+ assert call_arg == {"keys": ["ssh-dss"]}
+
class PasswordPassphraseTests(ClientTest):
# TODO: most of these could reasonably be set up to use mocks/assertions