File: //usr/lib/python3/dist-packages/twisted/conch/test/__pycache__/test_connection.cpython-310.pyc
o
�bIr � @ s� d Z ddlZddlmZ ddlmZ ddlmZ ddlm Z ed�Z
ddlmZ e
r3dd lm
Z
mZ nG d
d� d�ZG dd
� d
ej�ZG dd� d�ZG dd� dej�ZG dd� de j�ZG dd� de j�ZdS )z1
This module tests twisted.conch.ssh.connection.
� N)�channel)�
test_userauth)�
requireModule)�unittest�cryptography)�error)�common�
connectionc @ s e Zd ZG dd� d�ZdS )r c @ s e Zd ZdS )zconnection.SSHConnectionN)�__name__�
__module__�__qualname__� r
r
�D/usr/lib/python3/dist-packages/twisted/conch/test/test_connection.py�
SSHConnection s r N)r
r r r r
r
r
r r s r c @ sd e Zd ZdZdZdZdZdd� Zdd� Zdd � Z d
d� Z
dd
� Zdd� Zdd� Z
dd� Zdd� ZdS )�TestChannela�
A mocked-up version of twisted.conch.ssh.channel.SSHChannel.
@ivar gotOpen: True if channelOpen has been called.
@type gotOpen: L{bool}
@ivar specificData: the specific channel open data passed to channelOpen.
@type specificData: L{bytes}
@ivar openFailureReason: the reason passed to openFailed.
@type openFailed: C{error.ConchError}
@ivar inBuffer: a C{list} of strings received by the channel.
@type inBuffer: C{list}
@ivar extBuffer: a C{list} of 2-tuples (type, extended data) of received by
the channel.
@type extBuffer: C{list}
@ivar numberRequests: the number of requests that have been made to this
channel.
@type numberRequests: L{int}
@ivar gotEOF: True if the other side sent EOF.
@type gotEOF: L{bool}
@ivar gotOneClose: True if the other side closed the connection.
@type gotOneClose: L{bool}
@ivar gotClosed: True if the channel is closed.
@type gotClosed: L{bool}
� TestChannelFc C s
d| j S )NzTestChannel %i)�id��selfr
r
r � logPrefix: s
zTestChannel.logPrefixc C s4 d| _ || _g | _g | _d| _d| _d| _d| _dS )zF
The channel is open. Set up the instance variables.
Tr FN)�gotOpen�specificData�inBuffer� extBuffer�numberRequests�gotEOF�gotOneClose� gotClosed)r r r
r
r �channelOpen= s
zTestChannel.channelOpenc C s
|| _ dS )zD
Opening the channel failed. Store the reason why.
N)�openFailureReason)r �reasonr
r
r �
openFailedJ �
zTestChannel.openFailedc C s | j d7 _ |dkS )z_
A test request. Return True if data is 'data'.
@type data: L{bytes}
� � data)r �r �datar
r
r �request_testP s zTestChannel.request_testc C s | j �|� dS )z=
Data was received. Store it in the buffer.
N)r �appendr% r
r
r �dataReceivedY s zTestChannel.dataReceivedc C s | j �||f� dS )zF
Extended data was received. Store it in the buffer.
N)r r( )r �coder&