diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2017-06-06 13:26:43 -0700 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2017-06-06 13:26:43 -0700 |
commit | 63dd0e2c2aa2413dd1032de5b2be5b9cc46dac2b (patch) | |
tree | 5dd1b9bd36792759d412ed8a2780681cf1b952c8 /tests | |
parent | c1233679c448b445ec991710d259eec0a9f64b61 (diff) | |
parent | 1c88acaac8afd7d0dbf0062bcabff1795a4a729f (diff) |
Merge branch 'master' into 983-int
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_client.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_client.py b/tests/test_client.py index a340be00..3a9001e2 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -418,3 +418,20 @@ class SSHClientTest (unittest.TestCase): 'Expected original SSHException in exception') else: self.assertFalse(False, 'SSHException was not thrown.') + + + def test_missing_key_policy_accepts_classes_or_instances(self): + """ + Client.missing_host_key_policy() can take classes or instances. + """ + # AN ACTUAL UNIT TEST?! GOOD LORD + # (But then we have to test a private API...meh.) + client = paramiko.SSHClient() + # Default + assert isinstance(client._policy, paramiko.RejectPolicy) + # Hand in an instance (classic behavior) + client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + assert isinstance(client._policy, paramiko.AutoAddPolicy) + # Hand in just the class (new behavior) + client.set_missing_host_key_policy(paramiko.AutoAddPolicy) + assert isinstance(client._policy, paramiko.AutoAddPolicy) |