class SSHCommandClientEndpointTestsMixin: (source)
Known subclasses: twisted.conch.test.test_endpoints.ExistingConnectionTests
, twisted.conch.test.test_endpoints.NewConnectionTests
Tests for SSHCommandClientEndpoint
, an IStreamClientEndpoint
implementations which connects a protocol with the stdin and stdout of a command running in an SSH session.
These tests apply to SSHCommandClientEndpoint
whether it is constructed using SSHCommandClientEndpoint.existingConnection
or SSHCommandClientEndpoint.newConnection
.
Subclasses must override create
, assertClientTransportState
, and finishConnection
.
Method | assert |
Make an assertion about the connectedness of the given protocol's transport. Override this to implement either a check for the connection still being open or having been closed as appropriate. |
Method | connected |
Set up an in-memory connection between protocols created by serverFactory and clientFactory. |
Method | create |
Create and return a new SSHCommandClientEndpoint to be tested. Override this to implement creation in an interesting way the endpoint. |
Method | finish |
Do any remaining work necessary to complete an in-memory connection attempted initiated using self.reactor. |
Method | record |
Hook into and record events which happen to protocol. |
Method | set |
Undocumented |
Method | test_build |
Once the necessary SSH actions have completed successfully, SSHCommandClientEndpoint.connect uses the factory passed to it to construct a protocol instance by calling its buildProtocol method with an address object representing the SSH connection and command executed. |
Method | test_channel |
If a channel cannot be opened on the authenticated SSH connection, the Deferred returned by SSHCommandClientEndpoint.connect fires with a Failure wrapping the reason given by the server. |
Method | test_connection |
When the command closes the channel, the protocol's connectionLost method is called. |
Method | test_data |
After establishing the connection, when the command on the SSH server produces output, it is delivered to the protocol's dataReceived method. |
Method | test_exec |
If execution of the command is cancelled via the Deferred returned by SSHCommandClientEndpoint.connect , the connection is closed immediately. |
Method | test_exec |
If execution of the command fails, the Deferred returned by SSHCommandClientEndpoint.connect fires with a Failure wrapping the reason given by the server. |
Method | test_make |
SSHCommandClientEndpoint establishes an SSH connection, creates a channel in it, runs a command in that channel, and uses the protocol's makeConnection to associate it with a protocol representing that command's stdin and stdout. |
Method | test_non |
When the command exits with a non-zero signal, the protocol's connectionLost method is called with a Failure wrapping an exception which encapsulates that status. |
Method | test_non |
When the command exits with a non-zero status, the protocol's connectionLost method is called with a Failure wrapping an exception which encapsulates that status. |
Method | test |
The transport connected to the protocol has a write method which sends bytes to the input of the command executing on the SSH server. |
Method | test_write |
The transport connected to the protocol has a writeSequence method which sends bytes to the input of the command executing on the SSH server. |
Method | test_zero |
When the command exits with a non-zero status, the protocol's connectionLost method is called with a Failure wrapping an exception which encapsulates that status. |
Instance Variable | client |
Undocumented |
Instance Variable | factory |
Undocumented |
Instance Variable | hostname |
Undocumented |
Instance Variable | passwd |
Undocumented |
Instance Variable | password |
Undocumented |
Instance Variable | port |
Undocumented |
Instance Variable | portal |
Undocumented |
Instance Variable | reactor |
Undocumented |
Instance Variable | realm |
Undocumented |
Instance Variable | server |
Undocumented |
Instance Variable | user |
Undocumented |
Method | _exit |
Test handling of non-zero exit statuses or exit signals. |
twisted.conch.test.test_endpoints.ExistingConnectionTests
, twisted.conch.test.test_endpoints.NewConnectionTests
Make an assertion about the connectedness of the given protocol's transport. Override this to implement either a check for the connection still being open or having been closed as appropriate.
Parameters | |
client | The client whose state is being checked. |
immediate | Boolean indicating whether the connection was closed immediately or not. |
Set up an in-memory connection between protocols created by serverFactory and clientFactory.
Returns | |
A three-tuple. The first element is the protocol created by serverFactory. The second element is the protocol created by clientFactory. The third element is the IOPump connecting them. |
twisted.conch.test.test_endpoints.ExistingConnectionTests
, twisted.conch.test.test_endpoints.NewConnectionTests
Create and return a new SSHCommandClientEndpoint
to be tested. Override this to implement creation in an interesting way the endpoint.
twisted.conch.test.test_endpoints.ExistingConnectionTests
, twisted.conch.test.test_endpoints.NewConnectionTests
Do any remaining work necessary to complete an in-memory connection attempted initiated using self.reactor.
Hook into and record events which happen to protocol.
Parameters | |
server:IProtocol provider | The SSH server protocol over which protocol is running. |
protocol | |
event | |
no |
twisted.conch.test.test_endpoints.ExistingConnectionTests
, twisted.conch.test.test_endpoints.NewConnectionTests
Undocumented
Once the necessary SSH actions have completed successfully, SSHCommandClientEndpoint.connect
uses the factory passed to it to construct a protocol instance by calling its buildProtocol method with an address object representing the SSH connection and command executed.
If a channel cannot be opened on the authenticated SSH connection, the Deferred
returned by SSHCommandClientEndpoint.connect
fires with a Failure
wrapping the reason given by the server.
After establishing the connection, when the command on the SSH server produces output, it is delivered to the protocol's dataReceived method.
If execution of the command is cancelled via the Deferred
returned by SSHCommandClientEndpoint.connect
, the connection is closed immediately.
If execution of the command fails, the Deferred
returned by SSHCommandClientEndpoint.connect
fires with a Failure
wrapping the reason given by the server.
SSHCommandClientEndpoint
establishes an SSH connection, creates a channel in it, runs a command in that channel, and uses the protocol's makeConnection to associate it with a protocol representing that command's stdin and stdout.
When the command exits with a non-zero signal, the protocol's connectionLost method is called with a Failure
wrapping an exception which encapsulates that status.
Additional packet contents are logged at the info level.
When the command exits with a non-zero status, the protocol's connectionLost method is called with a Failure
wrapping an exception which encapsulates that status.
The transport connected to the protocol has a write method which sends bytes to the input of the command executing on the SSH server.
The transport connected to the protocol has a writeSequence method which sends bytes to the input of the command executing on the SSH server.
When the command exits with a non-zero status, the protocol's connectionLost method is called with a Failure
wrapping an exception which encapsulates that status.