Test TransportBase. It implements the non-server/client specific parts of the SSH transport protocol.

Method test_sendVersion No summary
Method test_sendPacketPlain No summary
Method test_sendPacketEncrypted Test that packets sent while encryption is enabled are sent correctly. The whole packet should be encrypted.
Method test_sendPacketCompressed Test that packets sent while compression is enabled are sent correctly. The packet type and data should be encrypted.
Method test_sendPacketBoth Test that packets sent while compression and encryption are enabled are sent correctly. The packet type and data should be compressed and then the whole packet should be encrypted.
Method test_getPacketPlain Test that packets are retrieved correctly out of the buffer when no encryption is enabled.
Method test_getPacketEncrypted Test that encrypted packets are retrieved correctly. See test_sendPacketEncrypted.
Method test_getPacketCompressed Test that compressed packets are retrieved correctly. See test_sendPacketCompressed.
Method test_getPacketBoth Test that compressed and encrypted packets are retrieved correctly. See test_sendPacketBoth.
Method test_ciphersAreValid Test that all the supportedCiphers are valid.
Method test_sendKexInit No summary
Method test_receiveKEXINITReply Immediately after connecting, the transport expects a KEXINIT message and does not reply to it.
Method test_sendKEXINITReply When a KEXINIT message is received which is not a reply to an earlier KEXINIT message which was sent, a KEXINIT reply is sent.
Method test_sendKexInitTwiceFails No summary
Method test_sendKexInitBlocksOthers After SSHTransportBase.sendKexInit has been called, messages types other than the following are queued and not sent until after NEWKEYS is sent by SSHTransportBase._keySetup.
Method test_sendDebug No summary
Method test_receiveDebug Test that debug messages are received correctly. See test_sendDebug.
Method test_sendIgnore Test that ignored messages are sent correctly. Payload:: string ignored data
Method test_receiveIgnore Test that ignored messages are received correctly. See test_sendIgnore.
Method test_sendUnimplemented Test that unimplemented messages are sent correctly. Payload:: uint32 sequence number
Method test_receiveUnimplemented Test that unimplemented messages are received correctly. See test_sendUnimplemented.
Method test_sendDisconnect No summary
Method test_receiveDisconnect Test that disconnection messages are received correctly. See test_sendDisconnect.
Method test_dataReceived Test that dataReceived parses packets and dispatches them to ssh_* methods.
Method test_service Test that the transport can set the running service and dispatches packets to the service's packetReceived method.
Method test_avatar Test that the transport notifies the avatar of disconnections.
Method test_isEncrypted Test that the transport accurately reflects its encrypted status.
Method test_isVerified Test that the transport accurately reflects its verified status.
Method test_loseConnection Test that loseConnection sends a disconnect message and closes the connection.
Method test_badVersion Test that the transport disconnects when it receives a bad version.
Method test_dataBeforeVersion Test that the transport ignores data sent before the version string.
Method test_compatabilityVersion Test that the transport treats the compatibility version (1.99) as equivalent to version 2.0.
Method test_dataReceivedSSHVersionUnixNewline It can parse the SSH version string even when it ends only in Unix newlines (CR) and does not follows the RFC 4253 to use network newlines (CR LF).
Method test_dataReceivedSSHVersionTrailingSpaces The trailing spaces from SSH version comment are not removed.
Method test_supportedVersionsAreAllowed If an unusual SSH version is received and is included in supportedVersions, an unsupported version error is not emitted.
Method test_unsupportedVersionsCallUnsupportedVersionReceived If an unusual SSH version is received and is not included in supportedVersions, an unsupported version error is emitted.
Method test_badPackets Test that the transport disconnects with an error when it receives bad packets.
Method test_unimplementedPackets Test that unimplemented packet types cause MSG_UNIMPLEMENTED packets to be sent.
Method test_multipleClasses Test that multiple instances have distinct states.

Inherited from TransportTestCase:

Method setUp Undocumented
Method finishKeyExchange Deliver enough additional messages to proto so that the key exchange which is started in SSHTransportBase.connectionMade completes and non-key exchange messages can be sent and received.
Method simulateKeyExchange Finish a key exchange by calling _keySetup with the given arguments. Also do extra whitebox stuff to satisfy that method's assumption that some kind of key exchange has actually taken place.

Inherited from TestCase (via TransportTestCase):

Instance Variable timeout A real number of seconds. If set, the test will raise an error if it takes longer than timeout seconds. If not set, util.DEFAULT_TIMEOUT_DURATION is used.
Method __init__ Construct an asynchronous test case for methodName.
Method assertFailure Fail if deferred does not errback with one of expectedFailures. Returns the original Deferred with callbacks added. You will need to return this Deferred from your test case.
Method __call__ Run the test. Should always do exactly the same thing as run().
Method deferSetUp Undocumented
Method deferTestMethod Undocumented
Method deferTearDown Undocumented
Method deferRunCleanups Run any scheduled cleanups and report errors (if any to the result object.
Method addCleanup Extend the base cleanup feature with support for cleanup functions which return Deferreds.
Method getSuppress Undocumented
Method getTimeout No summary
Method _run Run a single method, either a test method or fixture.
Method _ebDeferSetUp Undocumented
Method _cbDeferTestMethod Undocumented
Method _ebDeferTestMethod Undocumented
Method _ebDeferTearDown Undocumented
Method _cbDeferRunCleanups Undocumented
Method _cleanUp Undocumented
Method _classCleanUp Undocumented
Method _makeReactorMethod Create a method which wraps the reactor method name. The new method issues a deprecation warning and calls the original.
Method _deprecateReactor Deprecate iterate, crash and stop on reactor. That is, each method is wrapped in a function that issues a deprecation warning, then calls the original.
Method _undeprecateReactor Restore the deprecated reactor methods. Undoes what _deprecateReactor did.
Method _runCleanups Run the cleanups added with addCleanup in order.
Method _runFixturesAndTest Really run setUp, the test method, and tearDown. Any of these may return defer.Deferreds. After they complete, do some reactor cleanup.
Method _wait Take a Deferred that only ever callbacks. Block until it happens.

Inherited from SynchronousTestCase (via TransportTestCase, TestCase):

Instance Variable failureException An exception class, defaulting to FailTest. If the test method raises this exception, it will be reported as a failure, rather than an exception. All of the assertion methods raise this if the assertion fails.
Instance Variable skip None or a string explaining why this test is to be skipped. If defined, the test will not be run. Instead, it will be reported to the result object as 'skipped' (if the TestResult supports skipping).
Instance Variable todo None, a string or a tuple of (errors, reason) where errors is either an exception class or an iterable of exception classes, and reason is a string. See Todo or makeTodo for more information.
Instance Variable suppress None or a list of tuples of (args, kwargs) to be passed to warnings.filterwarnings. Use these to suppress warnings raised in a test. Useful for testing deprecated code. See also util.suppress.
Method __eq__ No summary
Method __ne__ Undocumented
Method __hash__ Undocumented
Method shortDescription Undocumented
Method getSkip No summary
Method getTodo No summary
Method runTest If no methodName argument is passed to the constructor, run will treat this method as the thing with the actual test inside.
Method run Run the test case, storing the results in result.
Method patch Monkey patch an object for the duration of the test.
Method flushLoggedErrors Remove stored errors received from the log.
Method flushWarnings Remove stored warnings from the list of captured warnings and return them.
Method callDeprecated Call a function that should have been deprecated at a specific version and in favor of a specific alternative, and assert that it was thusly deprecated.
Method mktemp Create a new path name which can be used for a new file or directory.
Method _getSuppress No summary
Method _getSkipReason Return the reason to use for skipping a test method.
Method _installObserver Undocumented
Method _removeObserver Undocumented

Inherited from _Assertions (via TransportTestCase, TestCase, SynchronousTestCase):

Method fail Absolutely fail the test. Do not pass go, do not collect $200.
Method assertFalse Fail the test if condition evaluates to True.
Method assertTrue Fail the test if condition evaluates to False.
Method assertRaises Fail the test unless calling the function f with the given args and kwargs raises exception. The failure will report the traceback and call stack of the unexpected exception.
Method assertEqual Fail the test if first and second are not equal.
Method assertIs Fail the test if first is not second. This is an obect-identity-equality test, not an object equality (i.e. __eq__) test.
Method assertIsNot Fail the test if first is second. This is an obect-identity-equality test, not an object equality (i.e. __eq__) test.
Method assertNotEqual Fail the test if first == second.
Method assertIn Fail the test if containee is not found in container.
Method assertNotIn Fail the test if containee is found in container.
Method assertNotAlmostEqual Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
Method assertAlmostEqual Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
Method assertApproximates Fail if first - second > tolerance
Method assertSubstring Fail if substring does not exist within astring.
Method assertNotSubstring Fail if astring contains substring.
Method assertWarns Fail if the given function doesn't generate the specified warning when called. It calls the function, checks the warning, and forwards the result of the function if everything is fine.
Method assertIsInstance Fail if instance is not an instance of the given class or of one of the given classes.
Method assertNotIsInstance Fail if instance is an instance of the given class or of one of the given classes.
Method successResultOf Return the current success result of deferred or raise self.failureException.
Method failureResultOf Return the current failure result of deferred or raise self.failureException.
Method assertNoResult Assert that deferred does not have a result at this point.
Method assertRegex Fail the test if a regexp search of text fails.
def test_sendVersion(self):

Test that the first thing sent over the connection is the version string. The 'softwareversion' part must consist of printable US-ASCII characters, with the exception of whitespace characters and the minus sign.

RFC 4253, section 4.2.

def test_sendPacketPlain(self):

Test that plain (unencrypted, uncompressed) packets are sent correctly. The format is:

   uint32 length (including type and padding length)
   byte padding length
   byte type
   bytes[length-padding length-2] data
   bytes[padding length] padding
def test_sendPacketEncrypted(self):

Test that packets sent while encryption is enabled are sent correctly. The whole packet should be encrypted.

def test_sendPacketCompressed(self):

Test that packets sent while compression is enabled are sent correctly. The packet type and data should be encrypted.

def test_sendPacketBoth(self):

Test that packets sent while compression and encryption are enabled are sent correctly. The packet type and data should be compressed and then the whole packet should be encrypted.

def test_getPacketPlain(self):

Test that packets are retrieved correctly out of the buffer when no encryption is enabled.

def test_getPacketEncrypted(self):

Test that encrypted packets are retrieved correctly. See test_sendPacketEncrypted.

def test_getPacketCompressed(self):

Test that compressed packets are retrieved correctly. See test_sendPacketCompressed.

def test_getPacketBoth(self):

Test that compressed and encrypted packets are retrieved correctly. See test_sendPacketBoth.

def test_ciphersAreValid(self):

Test that all the supportedCiphers are valid.

def test_sendKexInit(self):

Test that the KEXINIT (key exchange initiation) message is sent correctly. Payload:

   bytes[16] cookie
   string key exchange algorithms
   string public key algorithms
   string outgoing ciphers
   string incoming ciphers
   string outgoing MACs
   string incoming MACs
   string outgoing compressions
   string incoming compressions
   bool first packet follows
   uint32 0
def test_receiveKEXINITReply(self):

Immediately after connecting, the transport expects a KEXINIT message and does not reply to it.

def test_sendKEXINITReply(self):

When a KEXINIT message is received which is not a reply to an earlier KEXINIT message which was sent, a KEXINIT reply is sent.

def test_sendKexInitTwiceFails(self):

A new key exchange cannot be started while a key exchange is already in progress. If an attempt is made to send a KEXINIT message using SSHTransportBase.sendKexInit while a key exchange is in progress causes that method to raise a RuntimeError.

def test_sendKexInitBlocksOthers(self):

After SSHTransportBase.sendKexInit has been called, messages types other than the following are queued and not sent until after NEWKEYS is sent by SSHTransportBase._keySetup.

RFC 4253, section 7.1.

def test_sendDebug(self):

Test that debug messages are sent correctly. Payload:

   bool always display
   string debug message
   string language
def test_receiveDebug(self):

Test that debug messages are received correctly. See test_sendDebug.

def test_sendIgnore(self):

Test that ignored messages are sent correctly. Payload:

   string ignored data
def test_receiveIgnore(self):

Test that ignored messages are received correctly. See test_sendIgnore.

def test_sendUnimplemented(self):

Test that unimplemented messages are sent correctly. Payload:

   uint32 sequence number
def test_receiveUnimplemented(self):

Test that unimplemented messages are received correctly. See test_sendUnimplemented.

def test_sendDisconnect(self):

Test that disconnection messages are sent correctly. Payload:

   uint32 reason code
   string reason description
   string language
def test_receiveDisconnect(self):

Test that disconnection messages are received correctly. See test_sendDisconnect.

def test_dataReceived(self):

Test that dataReceived parses packets and dispatches them to ssh_* methods.

def test_service(self):

Test that the transport can set the running service and dispatches packets to the service's packetReceived method.

def test_avatar(self):

Test that the transport notifies the avatar of disconnections.

def test_isEncrypted(self):

Test that the transport accurately reflects its encrypted status.

def test_isVerified(self):

Test that the transport accurately reflects its verified status.

def test_loseConnection(self):

Test that loseConnection sends a disconnect message and closes the connection.

def test_badVersion(self):

Test that the transport disconnects when it receives a bad version.

def test_dataBeforeVersion(self):

Test that the transport ignores data sent before the version string.

def test_compatabilityVersion(self):

Test that the transport treats the compatibility version (1.99) as equivalent to version 2.0.

def test_dataReceivedSSHVersionUnixNewline(self):

It can parse the SSH version string even when it ends only in Unix newlines (CR) and does not follows the RFC 4253 to use network newlines (CR LF).

def test_dataReceivedSSHVersionTrailingSpaces(self):

The trailing spaces from SSH version comment are not removed.

The SSH version string needs to be kept as received (without CR LF end of line) as they are used in the host authentication process.

This can happen with a Bitvise SSH server which hides its version.

def test_supportedVersionsAreAllowed(self):

If an unusual SSH version is received and is included in supportedVersions, an unsupported version error is not emitted.

def test_unsupportedVersionsCallUnsupportedVersionReceived(self):

If an unusual SSH version is received and is not included in supportedVersions, an unsupported version error is emitted.

def test_badPackets(self):

Test that the transport disconnects with an error when it receives bad packets.

def test_unimplementedPackets(self):

Test that unimplemented packet types cause MSG_UNIMPLEMENTED packets to be sent.

def test_multipleClasses(self):

Test that multiple instances have distinct states.

API Documentation for twisted, generated by pydoctor at 2020-03-25 17:34:30.