summaryrefslogtreecommitdiffhomepage
path: root/tests/test_client.py
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2016-04-23 12:05:58 -0700
committerJeff Forcier <jeff@bitprophet.org>2016-04-23 12:05:58 -0700
commit8057fcabeedc280f36c340b6edb4feb60684291a (patch)
tree676f8edf13cfe5301b795309f69d5ff9859b134f /tests/test_client.py
parent403dac2b7915c2bd463fa843084cabdb0b19802e (diff)
Add regression test protecting against an issue found in #394.
Putting it in prior to merge of #394 because it also serves as a good explicit test of behavior which was previously implicit
Diffstat (limited to 'tests/test_client.py')
-rw-r--r--tests/test_client.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_client.py b/tests/test_client.py
index 05002d5e..d39febac 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -353,3 +353,23 @@ class SSHClientTest (unittest.TestCase):
self.tc.connect,
**kwargs
)
+
+ def test_8_auth_trickledown(self):
+ """
+ Failed key auth doesn't prevent subsequent pw auth from succeeding
+ """
+ # NOTE: re #387, re #394
+ # If pkey module used within Client._auth isn't correctly handling auth
+ # errors (e.g. if it allows things like ValueError to bubble up as per
+ # midway thru #394) client.connect() will fail (at key load step)
+ # instead of succeeding (at password step)
+ kwargs = dict(
+ # Password-protected key whose passphrase is not 'pygmalion' (it's
+ # 'television' as per tests/test_pkey.py). NOTE: must use
+ # key_filename, loading the actual key here with PKey will except
+ # immediately; we're testing the try/except crap within Client.
+ key_filename=[test_path('test_rsa_password.key')],
+ # Actual password for default 'slowdive' user
+ password='pygmalion',
+ )
+ self._test_connection(**kwargs)