File: //usr/lib/python3/dist-packages/twisted/conch/test/__pycache__/test_connection.cpython-38.pyc
U
W[�m � @ s� d Z ddlmZmZ ddlZddlmZ ed�Zddlm Z erRddl
mZmZ nG dd � d �Zdd
l
m
Z
ddlmZ ddlmZ dd
lmZ G dd� de
j�ZG dd� d�ZG dd� dej�ZG dd� dej�ZG dd� dej�ZdS )z1
This module tests twisted.conch.ssh.connection.
� )�division�absolute_importN)�
requireModule�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 )�channel)�long)�unittest)�
test_userauthc @ s` e Zd ZdZdZdZdd� Zdd� Zdd � Zd
d� Z dd
� Z
dd� Zdd� Zdd� Z
dd� 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
� logPrefix8 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
�
openFailedH s 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_testN s zTestChannel.request_testc C s | j �|� dS )z=
Data was received. Store it in the buffer.
N)r �appendr'