Current File : //lib/python3/dist-packages/twisted/conch/test/__pycache__/test_connection.cpython-312.pyc |
�
Ϫ�fHr � �B � d Z ddlZddlmZ ddlmZ ddlmZ ddlm Z ed� Z
ddlmZ e
r dd lm
Z
mZ n
G d
� d� Z G d� d
ej � Z G d� d� Z G d� dej$ � Z G d� de j( � Z G d� de j( � Zy)z1
This module tests twisted.conch.ssh.connection.
� N)�channel)�
test_userauth)�
requireModule)�unittest�cryptography)�error)�common�
connectionc � � e Zd Z G d� d� Zy)r
c � � e Zd Zy)�connection.SSHConnectionN)�__name__�
__module__�__qualname__� � �D/usr/lib/python3/dist-packages/twisted/conch/test/test_connection.py�
SSHConnectionr
s � �r r N)r r r r r r r r
r
s � � � r r
c �R � e Zd ZdZdZdZdZd� Zd� Zd� Z d� Z
d� Zd � Zd
� Z
d� Zd� Zy
)�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 � � d| j z S )NzTestChannel %i)�id��selfs r � logPrefixzTestChannel.logPrefix: s � ��$�'�'�)�)r c �t � d| _ || _ g | _ g | _ d| _ d| _ d| _ d| _ y)zF
The channel is open. Set up the instance variables.
Tr FN)�gotOpen�specificData�inBuffer� extBuffer�numberRequests�gotEOF�gotOneClose� gotClosed)r r s r �channelOpenzTestChannel.channelOpen= s? � � ���(�����
���������� �����r c � � || _ y)zD
Opening the channel failed. Store the reason why.
N)�openFailureReason)r �reasons r �
openFailedzTestChannel.openFailedJ s � � "(��r c �6 � | xj dz
c_ |dk( S )z_
A test request. Return True if data is 'data'.
@type data: L{bytes}
� � data)r"