Skip to content

Commit

Permalink
Re-run regular Transport test suite with new experimental subclass too
Browse files Browse the repository at this point in the history
  • Loading branch information
bitprophet committed May 25, 2023
1 parent 6137821 commit c47ed0b
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/test_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
SSHException,
IncompatiblePeer,
SecurityOptions,
ServiceRequestingTransport,
Transport,
)
from paramiko.auth_handler import AuthOnlyHandler
from paramiko import OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED
from paramiko.common import (
DEFAULT_MAX_PACKET_SIZE,
Expand Down Expand Up @@ -82,6 +84,10 @@


class TransportTest(unittest.TestCase):
# TODO: this can get nuked once ServiceRequestingTransport becomes the
# only Transport, as it has this baked in.
_auth_handler_class = AuthHandler

def setUp(self):
self.socks = LoopSocket()
self.sockc = LoopSocket()
Expand Down Expand Up @@ -1030,7 +1036,7 @@ def _expect_unimplemented(self):
def test_server_transports_reject_client_message_types(self):
# TODO: handle Transport's own tables too, not just its inner auth
# handler's table. See TODOs in auth_handler.py
some_handler = AuthHandler(self.tc) # kludge to get _some_ AH instance
some_handler = self._auth_handler_class(self.tc)
for message_type in some_handler._client_handler_table:
self._send_client_message(message_type)
self._expect_unimplemented()
Expand All @@ -1047,6 +1053,21 @@ def test_server_rejects_client_MSG_USERAUTH_SUCCESS(self):
self._expect_unimplemented()


# TODO: for now this is purely a regression test. It needs actual tests of the
# intentional new behavior too!
class ServiceRequestingTransportTest(TransportTest):
_auth_handler_class = AuthOnlyHandler

def setUp(self):
# Copypasta (Transport init is load-bearing)
self.socks = LoopSocket()
self.sockc = LoopSocket()
self.sockc.link(self.socks)
# New class who dis
self.tc = ServiceRequestingTransport(self.sockc)
self.ts = ServiceRequestingTransport(self.socks)


class AlgorithmDisablingTests(unittest.TestCase):
def test_preferred_lists_default_to_private_attribute_contents(self):
t = Transport(sock=Mock())
Expand Down

0 comments on commit c47ed0b

Please sign in to comment.