diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2017-12-18 14:09:41 -0800 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2017-12-31 16:10:47 -0500 |
commit | e87d14cf96410fdcc1f642f70926a46c46686f25 (patch) | |
tree | 4e77bede805e253cfd81bb18ddd73ea9d7c90d61 | |
parent | 430213d2949e8d10ac7e30b0b56c35522f1659cb (diff) | |
download | paramiko-e87d14cf96410fdcc1f642f70926a46c46686f25.tar.gz |
Migrate the base case interactive auth test
-rw-r--r-- | tests/authentication.py | 23 | ||||
-rw-r--r-- | tests/test_auth.py | 24 |
2 files changed, 22 insertions, 25 deletions
diff --git a/tests/authentication.py b/tests/authentication.py index 2403af64..42fde80a 100644 --- a/tests/authentication.py +++ b/tests/authentication.py @@ -80,7 +80,28 @@ class Interactive: # TODO: and what's the diff between transport's interactive vs # interactive_dumb? # TODO: and how (is?) it different from what's used for TOTP - pass + + # TODO: identify other test cases to expand around this one + def interactive_auth_base_case(self, trans): + """ + verify keyboard-interactive auth works. + """ + trans.connect() + # TODO: mock the server transport harder instead of using these + # globals, ew. + global got_title, got_instructions, got_prompts + got_title, got_instructions, got_prompts = None, None, None + def handler(title, instructions, prompts): + # Big meh. + global got_title, got_instructions, got_prompts + got_title = title + got_instructions = instructions + got_prompts = prompts + return ['cat'] + remains = trans.auth_interactive('commie', handler) + assert got_title == 'password' + assert got_prompts == [('Password', False)] + assert remains == [] class UnencryptedPubKey: diff --git a/tests/test_auth.py b/tests/test_auth.py index c03471bf..63bdc5d1 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -28,30 +28,6 @@ from pytest import raises from ._util import _support, slow, utf8_password -class TestInteractiveAuth: - # TODO: identify other test cases to expand around this one - def test_interactive_auth(self, trans): - """ - verify keyboard-interactive auth works. - """ - trans.connect() - # TODO: mock the server transport harder instead of using these - # globals, ew. - global got_title, got_instructions, got_prompts - got_title, got_instructions, got_prompts = None, None, None - def handler(title, instructions, prompts): - # Big meh. - global got_title, got_instructions, got_prompts - got_title = title - got_instructions = instructions - got_prompts = prompts - return ['cat'] - remains = trans.auth_interactive('commie', handler) - assert got_title == 'password' - assert got_prompts == [('Password', False)] - assert remains == [] - - class TestMultipartAuth: # TODO: clarify the name of this to show it's only one specific multipart # auth style |