diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2017-06-06 12:21:49 -0700 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2017-06-06 12:21:49 -0700 |
commit | 36b5617baf359a85d5bce7d240da5d2023a4226a (patch) | |
tree | f5ea90ea9da2485d110fb6e89b9459140f00314a | |
parent | 9d2af83f1474fd594f3dd1fea20839a9751a6a4b (diff) |
Failing test proving need for #857
-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) |