File: //lib/python3/dist-packages/twisted/conch/test/__pycache__/test_default.cpython-38.pyc
U
W[@- � @ s* d Z ddlmZmZ ddlZddlmZ ed�rzed�rzddlmZ ddl m
Z
dd lmZ dd
l
mZ ddlmZ dZndZdd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ e� � r�dZ!neZ!dZ"ej#�$� s�dZ"ej%�$� �sdZ"G dd� de�Z&G dd� de�Z'dS )z,
Tests for L{twisted.conch.client.default}.
� )�absolute_import�divisionN)�
requireModuleZcryptographyZpyasn1)�SSHAgentClient)�SSHUserAuthClient)�ConchOptions)�default)�KeyzBcryptography and PyASN1 required for twisted.conch.client.default.)�TestCase)�FilePath)�
ConchError)�keydata)�StringTransport)�nativeString)�platformzlgenericAnswers and getPassword does not work on Windows. Should be fixed as part of fixing bug 6409 and 6410z#sys.stdin is not an interactive ttyz$sys.stdout is not an interactive ttyc @ s� e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dd� Z
dd� Zdd� Ze
pZee_dd� Ze
plee_dd� Ze
p~ee_dd� Ze
p�ee_dS )�SSHUserAuthClientTestszm
Tests for L{SSHUserAuthClient}.
@type rsaPublic: L{Key}
@ivar rsaPublic: A public RSA key.
c C sZ t �tj�| _t| �� �| _| j�� | j� d�| _
| j
�tj� | j� d��tj� d S )NZid_rsa�
id_rsa.pub)
r �
fromStringr
ZpublicRSA_openssh� rsaPublicr Zmktemp�tmpdir�makedirs�child�rsaFile�
setContent�privateRSA_openssh��self� r �A/usr/lib/python3/dist-packages/twisted/conch/test/test_default.py�setUp7 s
zSSHUserAuthClientTests.setUpc C sf t dt� d�}t� }t� }|�|� ||_d}|�| j|� | �|� � d| j�
� d | d � dS )z�
When connected to an agent, L{SSHUserAuthClient} can use it to
request signatures of particular data with a particular L{Key}.
� userNs Sign heres -
s s )r r r r ZmakeConnection�keyAgentZsignDatar �assertEqual�value�blob)r �client�agent� transportZ cleartextr r r �test_signDataWithAgent@ s"