§
    Ètºf?É  ã                   ó¶  — d Z ddlZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
 ddlmZ ddlmZ ddlmZ ddlmZ ddlmZmZ dd	lmZ dd
lmZmZmZmZmZ ddlmZ ddl m!Z! ddl"m#Z#m$Z$ ddl%m&Z& ddl'm(Z( ddl)m*Z* ddl+m,Z, ddl-m.Z. ddl/m0Z0  e.d¦  «        Z1 e.d¦  «        Z2e1r9	 ddl3m4Z4 ddl5m6Z6 ddl7m8Z8 ddl9m:Z: ddl;m<Z<m=Z= ddl>m?Z? ddlm@Z@ n# eA$ r Y nw xY wdZBde2e1 ejC        ed¦  «        fv rdZB eeBd¦  «         G d „ d!e0¦  «        ¦   «         ZD G d"„ d#e0¦  «        ZE G d$„ d%e!¦  «        ZF G d&„ d'¦  «        ZG G d(„ d)¦  «        ZH ee¦  «         G d*„ d+e	¦  «        ¦   «         ZI eeBd¦  «         G d,„ d-e0¦  «        ¦   «         ZJ G d.„ d/¦  «        ZK G d0„ d1ejL        ¦  «        ZM G d2„ d3e¦  «        ZN eeBd¦  «         G d4„ d5eN¦  «        ¦   «         ZO eeBd¦  «         G d6„ d7eN¦  «        ¦   «         ZP eeBd¦  «         e e,d8¦  «         d9¦  «         e e,d:¦  «         d;¦  «         G d<„ d=eN¦  «        ¦   «         ¦   «         ¦   «         ZQdS )>z*
Tests for L{twisted.conch.scripts.cftp}.
é    N)ÚBytesIOÚTextIOWrapper)ÚskipIf)Úimplementer)Úls)Ú	ISFTPFile)ÚFileTransferTestAvatarÚSFTPTestBase)Úportal)ÚdeferÚerrorÚ
interfacesÚprotocolÚreactor)ÚClock)ÚStringTransport)ÚgetProcessOutputAndValueÚgetProcessValue)Úlog)ÚUserDatabase)ÚFilePath)Úwhich)ÚrequireModule)ÚTestCaseÚcryptographyztwisted.conch.unix)Úcftp)Ú
SSHSession)Úfiletransfer)ÚEXTENDED_DATA_STDERR)Ú
test_conchÚtest_ssh)Ú	FakeStdio)ÚFileTransferForTestAvatarFTz*don't run w/o spawnProcess or cryptographyc                   ó*   — e Zd ZdZdd„Zdd„Zdd„ZdS )ÚSSHSessionTestsz=
    Tests for L{twisted.conch.scripts.cftp.SSHSession}.
    ÚreturnNc                 óî   — t          ¦   «         | _        t          ¦   «         | _        | j        | j        _        t	          ¦   «         | _        t          | j        ¦  «        | _        | j        | j        _        d S ©N)r"   Ústdior   Úchannelr   ÚstderrBufferr   Ústderr©Úselfs    ú[/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/conch/test/test_cftp.pyÚsetUpzSSHSessionTests.setUp>   sT   € Ý‘[”[ˆŒ
Ý!‘|”|ˆŒØ!œZˆŒÔÝ#™IœIˆÔÝ# DÔ$5Ñ6Ô6ˆŒØ"œkˆŒÔÐÐó    c                 óv   — | j                              ¦   «          |                      | j        j        ¦  «         dS )z|
        L{twisted.conch.scripts.cftp.SSHSession.eofReceived} loses the write
        half of its stdio connection.
        N)r*   ÚeofReceivedÚ
assertTruer)   ÚwriteConnLostr-   s    r/   Útest_eofReceivedz SSHSessionTests.test_eofReceivedF   s5   € ð
 	Œ× Ò Ñ"Ô"Ð"Ø�Š˜œ
Ô0Ñ1Ô1Ð1Ð1Ð1r1   c                 óÚ   — d}|                      d¦  «        }| j                             t          |dz   ¦  «         |                      | j                             ¦   «         |dz   ¦  «         dS )zÉ
        L{twisted.conch.scripts.cftp.SSHSession.extReceived} decodes
        stderr data using UTF-8 with the "backslashescape" error handling and
        writes the result to its own stderr.
        u   â˜ƒúutf-8ó   ÿs   \xffN)Úencoder*   ÚextReceivedr   ÚassertEqualr+   Úgetvalue)r.   Ú	errorTextÚ
errorBytess      r/   Útest_extReceivedStderrz&SSHSessionTests.test_extReceivedStderrN   s   € ð "ˆ	Ø×%Ò% gÑ.Ô.ˆ
ØŒ× Ò Ý Ø˜Ñ ñ	
ô 	
ð 	
ð 	×ÒØÔ×&Ò&Ñ(Ô(Ø˜Ñ!ñ	
ô 	
ð 	
ð 	
ð 	
r1   )r&   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r0   r6   r@   © r1   r/   r%   r%   8   sZ   € € € € € ðð ð*ð *ð *ð *ð2ð 2ð 2ð 2ð
ð 
ð 
ð 
ð 
ð 
r1   r%   c                   óZ  — e Zd ZdZ eedd¦  «        €dZd„ Zd„ Zd„ Z	d„ Z
d	„ Z ej        ¦   «         Z	 	  ej        ej        d
¦  «         dZn# ej        $ r dZY nw xY w ej        ej        e¦  «         n#  ej        ej        e¦  «         w xY w eed¦  «        d„ ¦   «         Zd„ ZdS )ÚListingTestszƒ
    Tests for L{lsLine}, the function which generates an entry for a file or
    directory in an SFTP I{ls} command's output.
    ÚtzsetNz8Cannot test timestamp formatting code without time.tzsetc                 ó^  ‡ — d‰ _         ˆ fd„}‰                      t          d|¦  «         dt          j        v r]‰                      t          j        t          j        dt          j        d         ¦  «         ‰                      t          j	        ¦  «         dS d„ }‰                      |¦  «         dS )zo
        Patch the L{ls} module's time function so the results of L{lsLine} are
        deterministic.
        iÍ[c                  ó   •— ‰ j         S r(   )Únowr-   s   €r/   ÚfakeTimez$ListingTests.setUp.<locals>.fakeTimep   s
   ø€ Ø”8ˆOr1   ÚtimeÚTZc                  ój   — 	 t           j        d= n# t          $ r Y nw xY wt          j        ¦   «          d S )NrN   )ÚosÚenvironÚKeyErrorrM   rH   rE   r1   r/   Úcleanupz#ListingTests.setUp.<locals>.cleanup|   sC   € ðÝœ
 4Ð(Ð(øÝð ð ð Ø�Dðøøøå”
‘”���s   ‚ �
œN)
rK   Úpatchr   rP   rQ   Ú
addCleanupÚoperatorÚsetitemrM   rH   )r.   rL   rS   s   `  r/   r0   zListingTests.setUpi   s³   ø€ ð
 ˆŒð	ð 	ð 	ð 	ð 	ð 	�
Š
•2�v˜xÑ(Ô(Ð(ð •2”:ÐÐØ�OŠO�HÔ,­b¬j¸$ÅÄ
È4Ô@PÑQÔQÐQØ�OŠO�DœJÑ'Ô'Ð'Ð'Ð'ðð ð ð �OŠO˜GÑ$Ô$Ð$Ð$Ð$r1   c                 óp   — |t           j        d<   t          j        ¦   «          t	          j        d|¦  «        S )zl
        Call L{ls.lsLine} after setting the timezone to C{timezone} and return
        the result.
        rN   Úfoo)rP   rQ   rM   rH   r   ÚlsLine)r.   ÚtimezoneÚstats      r/   Ú_lsInTimezonezListingTests._lsInTimezone†   s-   € ð $�Œ
�4ÑÝŒ
‰ŒˆÝŒy˜ Ñ%Ô%Ð%r1   c                 óþ   — | j         dz
  }t          j        dddddddd|df
¦  «        }|                      |                      d|¦  «        d¦  «         |                      |                      d|¦  «        d¦  «         dS )z‘
        A file with an mtime six months (approximately) or more in the past has
        a listing including a low-resolution timestamp.
        é€r   úAmerica/New_Yorkz;!---------    0 0        0               0 Apr 26  1973 fooúPacific/Aucklandz;!---------    0 0        0               0 Apr 27  1973 fooN©rK   rP   Ústat_resultr<   r]   ©r.   Úthenr\   s      r/   Útest_oldFilezListingTests.test_oldFile‘   óŸ   € ð ŒxÐ0Ñ1ˆÝŒ~˜q ! Q¨¨1¨a°°A°t¸QÐ?Ñ@Ô@ˆà×ÒØ×ÒÐ1°4Ñ8Ô8ØIñ	
ô 	
ð 	
ð 	×ÒØ×ÒÐ1°4Ñ8Ô8ØIñ	
ô 	
ð 	
ð 	
ð 	
r1   c                 ó  — | j         dz
  dz   }t          j        dddddddd|df
¦  «        }|                      |                      d|¦  «        d¦  «         |                      |                      d|¦  «        d¦  «         dS )	úæ
        A file with a high-resolution timestamp which falls on a day of the
        month which can be represented by one decimal digit is formatted with
        one padding 0 to preserve the columns which come after it.
        r_   i€— r   r`   z;!---------    0 0        0               0 May 01  1973 foora   z;!---------    0 0        0               0 May 02  1973 fooNrb   rd   s      r/   Útest_oldSingleDigitDayOfMonthz*ListingTests.test_oldSingleDigitDayOfMonth£   ó¥   € ð ŒxÐ0Ñ1Ð5EÑFˆÝŒ~˜q ! Q¨¨1¨a°°A°t¸QÐ?Ñ@Ô@ˆà×ÒØ×ÒÐ1°4Ñ8Ô8ØIñ	
ô 	
ð 	
ð 	×ÒØ×ÒÐ1°4Ñ8Ô8ØIñ	
ô 	
ð 	
ð 	
ð 	
r1   c                 óþ   — | j         dz
  }t          j        dddddddd|df
¦  «        }|                      |                      d|¦  «        d¦  «         |                      |                      d|¦  «        d¦  «         dS )z¨
        A file with an mtime fewer than six months (approximately) in the past
        has a listing including a high-resolution timestamp excluding the year.
        é€›z r   r`   ú;!---------    0 0        0               0 Aug 28 17:33 foora   ú;!---------    0 0        0               0 Aug 29 09:33 fooNrb   rd   s      r/   Útest_newFilezListingTests.test_newFile·   rg   r1   ú
es_AR.UTF8FTz'The es_AR.UTF8 locale is not installed.c                 ó¸  — | j         dz
  }t          j        dddddddd|df
¦  «        }t          j        ¦   «         }t          j        t          j        d¦  «         |                      t          j        t          j        |¦  «         |                      |  	                    d|¦  «        d¦  «         |                      |  	                    d|¦  «        d¦  «         dS )	zC
        The month name in the date is locale independent.
        rm   r   rq   r`   rn   ra   ro   N)
rK   rP   rc   ÚlocaleÚ	getlocaleÚ	setlocaleÚLC_ALLrU   r<   r]   )r.   re   r\   ÚcurrentLocales       r/   Útest_localeIndependentz#ListingTests.test_localeIndependentÖ   sß   € ð ŒxÐ0Ñ1ˆÝŒ~˜q ! Q¨¨1¨a°°A°t¸QÐ?Ñ@Ô@ˆõ Ô(Ñ*Ô*ˆÝÔ�œ¨Ñ5Ô5Ð5Ø�Š�Ô(­&¬-¸ÑGÔGÐGà×ÒØ×ÒÐ1°4Ñ8Ô8ØIñ	
ô 	
ð 	
ð 	×ÒØ×ÒÐ1°4Ñ8Ô8ØIñ	
ô 	
ð 	
ð 	
ð 	
r1   c                 ó  — | j         dz
  dz   }t          j        dddddddd|df
¦  «        }|                      |                      d|¦  «        d¦  «         |                      |                      d|¦  «        d¦  «         dS )	ri   rm   i F r   r`   z;!---------    0 0        0               0 Sep 01 17:33 foora   z;!---------    0 0        0               0 Sep 02 09:33 fooNrb   rd   s      r/   Útest_newSingleDigitDayOfMonthz*ListingTests.test_newSingleDigitDayOfMonthí   rk   r1   )rA   rB   rC   rD   ÚgetattrrM   Úskipr0   r]   rf   rj   rp   rs   rt   rw   ru   rv   Ú
localeSkipÚErrorr   rx   rz   rE   r1   r/   rG   rG   `   sY  € € € € € ðð ð
 €wˆt�W˜dÑ#Ô#Ð+ØIˆð%ð %ð %ð:	&ð 	&ð 	&ð
ð 
ð 
ð$
ð 
ð 
ð(
ð 
ð 
ð( %�FÔ$Ñ&Ô&€Mð7ð	ØˆFÔ˜Vœ]¨LÑ9Ô9Ð9ð ˆJˆJøð Œ|ð 	ð 	ð 	ØˆJˆJˆJð	øøøð
 	ˆÔ˜œ¨Ñ6Ô6Ð6Ð6øÐˆÔ˜œ¨Ñ6Ô6Ð6Ð6øøøà€VˆJÐAÑBÔBð
ð 
ñ CÔBð
ð,
ð 
ð 
ð 
ð 
s)   ¶A ÁA8 ÁAÁA8 ÁAÁA8 Á8BrG   c                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )ÚInMemorySSHChannelzp
    Minimal implementation of a L{SSHChannel} like class which only reads and
    writes data from memory.
    c                 ód   •— || _         d| _        t          ¦   «                              ¦   «          dS )zt
        @param conn: The SSH connection associated with this channel.
        @type conn: L{SSHConnection}
        r   N)ÚconnÚlocalClosedÚsuperÚ__init__)r.   r‚   Ú	__class__s     €r/   r…   zInMemorySSHChannel.__init__  s0   ø€ ð
 ˆŒ	ØˆÔÝ‰Œ×ÒÑÔÐÐÐr1   )rA   rB   rC   rD   r…   Ú__classcell__)r†   s   @r/   r€   r€     sB   ø€ € € € € ðð ð
ð ð ð ð ð ð ð ð r1   r€   c                   ó$   — e Zd ZdZd„ Zd„ Zd„ ZdS )ÚFilesystemAccessExpectationszC
    A test helper used to support expected filesystem access.
    c                 ó   — i | _         d S r(   ©Ú_cacher-   s    r/   r…   z%FilesystemAccessExpectations.__init__  s   € ØˆŒˆˆr1   c                 ó   — || j         ||f<   dS )zü

        @param path: Path at which the stream is requested.
        @type path: L{str}

        @param path: Flags with which the stream is requested.
        @type path: L{str}

        @param stream: A stream.
        @type stream: C{File}
        Nr‹   )r.   ÚpathÚflagsÚstreams       r/   Úputz FilesystemAccessExpectations.put  s   € ð &,ˆŒ�T˜5�MÑ"Ð"Ð"r1   c                 ó:   — | j                              ||f¦  «        S )a  
        Remove a stream from the memory.

        @param path: Path at which the stream is requested.
        @type path: L{str}

        @param path: Flags with which the stream is requested.
        @type path: L{str}

        @return: A stream.
        @rtype: C{File}
        )rŒ   Úpop)r.   rŽ   r�   s      r/   r“   z FilesystemAccessExpectations.pop(  s   € ð Œ{�Š  e˜}Ñ-Ô-Ð-r1   N)rA   rB   rC   rD   r…   r‘   r“   rE   r1   r/   r‰   r‰     sK   € € € € € ðð ðð ð ð,ð ,ð ,ð.ð .ð .ð .ð .r1   r‰   c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚInMemorySFTPClienta'  
    A L{filetransfer.FileTransferClient} which does filesystem operations in
    memory, without touching the local disc or the network interface.

    @ivar _availableFiles: File like objects which are available to the SFTP
        client.
    @type _availableFiles: L{FilesystemRegister}
    c                 óP   — t          | ¦  «        | _        dddœ| _        || _        d S )Né   é
   )ÚrequestsÚ
buffersize)r€   Ú	transportÚoptionsÚ_availableFiles)r.   ÚavailableFiless     r/   r…   zInMemorySFTPClient.__init__B  s5   € Ý+¨DÑ1Ô1ˆŒàØð
ð 
ˆŒð  .ˆÔÐÐr1   c                 ó8   — | j                              ||¦  «        S )z}
        @see: L{filetransfer.FileTransferClient.openFile}.

        Retrieve and remove cached file based on flags.
        )r�   r“   )r.   Úfilenamer�   Úattrss       r/   ÚopenFilezInMemorySFTPClient.openFileJ  s   € ð Ô#×'Ò'¨°%Ñ8Ô8Ð8r1   N)rA   rB   rC   rD   r…   r¢   rE   r1   r/   r•   r•   8  s<   € € € € € ðð ð.ð .ð .ð9ð 9ð 9ð 9ð 9r1   r•   c                   ó<   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	S )
ÚInMemoryRemoteFilez;
    An L{ISFTPFile} which handles all data in memory.
    c                 ó<   — || _         t          j        | ¦  «         dS )zL
        @param name: Name of this file.
        @type name: L{str}
        N)Únamer   r…   )r.   r¦   s     r/   r…   zInMemoryRemoteFile.__init__Y  s"   € ð
 ˆŒ	ÝÔ˜ÑÔÐÐÐr1   c                 ó~   — |                       |¦  «         |                      |¦  «         t          j        | ¦  «        S )z/
        @see: L{ISFTPFile.writeChunk}
        )ÚseekÚwriter   Úsucceed)r.   ÚstartÚdatas      r/   Ú
writeChunkzInMemoryRemoteFile.writeChunka  s8   € ð 	�	Š	�%ÑÔÐØ�
Š
�4ÑÔÐÝŒ}˜TÑ"Ô"Ð"r1   c                 ó   — d| _         dS )zo
        @see: L{ISFTPFile.writeChunk}

        Keeps data after file was closed to help with testing.
        TN)Ú_closedr-   s    r/   ÚclosezInMemoryRemoteFile.closei  s   € ð ˆŒˆˆr1   c                 ó   — d S r(   rE   r-   s    r/   ÚgetAttrszInMemoryRemoteFile.getAttrsq  ó   € àˆr1   c                 ó   — d S r(   rE   )r.   ÚoffsetÚlengths      r/   Ú	readChunkzInMemoryRemoteFile.readChunku  r³   r1   c                 ó   — d S r(   rE   )r.   r¡   s     r/   ÚsetAttrszInMemoryRemoteFile.setAttrsy  r³   r1   c                 ó*   — t          j        | ¦  «        S )zb
        Get current data of file.

        Allow reading data event when file is closed.
        )r   r=   r-   s    r/   r=   zInMemoryRemoteFile.getvalue}  s   € õ Ô Ñ%Ô%Ð%r1   N)rA   rB   rC   rD   r…   r­   r°   r²   r·   r¹   r=   rE   r1   r/   r¤   r¤   S  s‡   € € € € € ðð ðð ð ð#ð #ð #ðð ð ðð ð ðð ð ðð ð ð&ð &ð &ð &ð &r1   r¤   c                   ó‚   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zdd„Zdd„Zd„ Zd„ Zd„ Zd„ ZdS )ÚStdioClientTestsz(
    Tests for L{cftp.StdioClient}.
    c                 ó>  — t          ¦   «         | _        t          | j        ¦  «        }t          j        |¦  «        | _        d| j        _        t          ¦   «         x| _        | j        _	        |  
                    dd¦  «         | j        j        j        | j        _        dS )zm
        Create a L{cftp.StdioClient} hooked up to dummy transport and a fake
        user database.
        ú/iô  é   N)r‰   ÚfakeFilesystemr•   r   ÚStdioClientÚclientÚcurrentDirectoryr   ÚdatabaseÚ_pwdÚsetKnownConsoleSizer›   )r.   Ú
sftpClients     r/   r0   zStdioClientTests.setUpŒ  s…   € õ
 ;Ñ<Ô<ˆÔÝ'¨Ô(;Ñ<Ô<ˆ
ÝÔ& zÑ2Ô2ˆŒØ'*ˆŒÔ$Ý+7©>¬>Ð9ˆŒ˜œÔ(ð
 	× Ò   bÑ)Ô)Ð)ð !%¤Ô 2Ô <ˆŒÔÐÐr1   c           	      ó  — | j                              t          j        ¦   «         dt	          j        ¦   «         dddt          j        ¦  «         | j         	                    d¦  «        }| 
                    | j        d¦  «         |S )zs
        The I{exec} command runs its arguments locally in a child process
        using the user's shell.
        ÚsecretéÒ  rY   Úbarzexec print(1 + 2)s   3
)rÄ   ÚaddUserÚgetpassÚgetuserrP   ÚgetuidÚsysÚ
executablerÂ   Ú_dispatchCommandÚaddCallbackr<   ©r.   Úds     r/   Ú	test_execzStdioClientTests.test_execŸ  sq   € ð
 	Œ×ÒÝŒOÑÔ˜x­¬©¬°d¸EÀ5Í#Ì.ñ	
ô 	
ð 	
ð ŒK×(Ò(Ð)<Ñ=Ô=ˆØ	�Š�dÔ&¨Ñ/Ô/Ð/Øˆr1   c           	      óô   — | j                              t          j        ¦   «         dt	          j        ¦   «         dddd¦  «         | j                             d¦  «        }|                     | j	        d¦  «         |S )zr
        If the local user has no shell, the I{exec} command runs its arguments
        using I{/bin/sh}.
        rÉ   rÊ   rY   rË   Ú zexec echo helloó   hello
©
rÄ   rÌ   rÍ   rÎ   rP   rÏ   rÂ   rÒ   rÓ   r<   rÔ   s     r/   Útest_execWithoutShellz&StdioClientTests.test_execWithoutShell¬  so   € ð
 	Œ×ÒÝŒOÑÔ˜x­¬©¬°d¸EÀ5È"ñ	
ô 	
ð 	
ð ŒK×(Ò(Ð):Ñ;Ô;ˆØ	�Š�dÔ&¨
Ñ3Ô3Ð3Øˆr1   c           	      óô   — | j                              t          j        ¦   «         dt	          j        ¦   «         dddd¦  «         | j                             d¦  «        }|                     | j	        d¦  «         |S )zO
        The I{exec} command is run for lines which start with C{"!"}.
        rÉ   rÊ   rY   rË   z/bin/shz!echo hellorÙ   rÚ   rÔ   s     r/   Ú	test_bangzStdioClientTests.test_bang¹  sn   € ð 	Œ×ÒÝŒOÑÔ˜x­¬©¬°d¸EÀ5È)ñ	
ô 	
ð 	
ð ŒK×(Ò(¨Ñ7Ô7ˆØ	�Š�dÔ&¨
Ñ3Ô3Ð3Øˆr1   c                 ó~   ‡‡‡— ddl Š G ˆˆˆfd„d¦  «        }|                      t          d |¦   «         ¦  «         dS )a  
        For the duration of this test, patch C{cftp}'s C{fcntl} module to return
        a fixed width and height.

        @param width: the width in characters
        @type width: L{int}
        @param height: the height in characters
        @type height: L{int}
        r   Nc                   ó   •— e Zd Zˆ ˆˆfd„ZdS )ú7StdioClientTests.setKnownConsoleSize.<locals>.FakeFcntlc                 ót   •— |‰j         k    r|                      d¦  «         t          j        d‰‰dd¦  «        S )Nz#Only window-size queries supported.Ú4Hr   )Ú
TIOCGWINSZÚfailÚstructÚpack)r.   ÚfdÚoptÚmutateÚheightÚttyÚwidths       €€€r/   Úioctlz=StdioClientTests.setKnownConsoleSize.<locals>.FakeFcntl.ioctlÓ  s;   ø€ Ø˜#œ.Ò(Ð(Ø—I’IÐCÑDÔDÐDÝ”{ 4¨°¸¸1Ñ=Ô=Ð=r1   N)rA   rB   rC   rí   )rê   rë   rì   s   €€€r/   Ú	FakeFcntlrà   Ò  s8   ø€ € € € € ð>ð >ð >ð >ð >ð >ð >ð >ð >r1   rî   Úfcntl)rë   rT   r   )r.   rì   rê   rî   rë   s    `` @r/   rÆ   z$StdioClientTests.setKnownConsoleSizeÅ  sp   øøø€ ð 	ˆ
ˆ
ˆ
ð	>ð 	>ð 	>ð 	>ð 	>ð 	>ð 	>ð 	>ð 	>ñ 	>ô 	>ð 	>ð 	�
Š
•4˜ ) )¡+¤+Ñ.Ô.Ð.Ð.Ð.r1   c                 óØ  — |                       dd¦  «         t          ¦   «         x}| j        _        t	          d¦  «        }d|_        t          j        |¦  «        }d|_        | 	                    ¦   «         }| 
                    d¦  «         |xj        dz  c_        | j                             ||¦  «         d}|                      | j        j                             ¦   «         |¦  «         d	S )
a(  
        L{StdioClient._printProgressBar} prints a progress description,
        including percent done, amount transferred, transfer rate, and time
        remaining, all based the given start time, the given L{FileWrapper}'s
        progress information and the reactor's current time.
        r˜   é"   ó   xó   samplei (  g       @i   s#   b'sample' 40% 4.0kB 2.0kBps 00:03 N)rÆ   r   rÂ   r   r   r¦   r   ÚFileWrapperÚsizeÚsecondsÚadvanceÚtotalÚ_printProgressBarr<   r›   Úvalue©r.   ÚclockÚwrappedÚwrapperÚ	startTimeÚresults         r/   Útest_printProgressBarReportingz/StdioClientTests.test_printProgressBarReportingÚ  sÏ   € ð 	× Ò   RÑ(Ô(Ð(Ý&+¡g¤gÐ-ˆ�”Ô#Ý˜$‘-”-ˆØ ˆŒÝÔ" 7Ñ+Ô+ˆØ ˆŒØ—M’M‘O”Oˆ	Ø�Š�cÑÔÐØˆŒ˜ÑˆŒàŒ×%Ò% g¨yÑ9Ô9Ð9à8ˆØ×Ò˜œÔ.×4Ò4Ñ6Ô6¸Ñ?Ô?Ð?Ð?Ð?r1   c                 ó€  — |                       dd¦  «         t          ¦   «         x}| j        _        t	          d¦  «        }d|_        t          j        |¦  «        }|                     ¦   «         }| j         	                    ||¦  «         d}|  
                    | j        j                             ¦   «         |¦  «         dS )z½
        L{StdioClient._printProgressBar} prints a progress description that
        indicates 0 bytes transferred if no bytes have been transferred and no
        time has passed.
        r˜   rñ   rò   ró   s!   b'sample'  0% 0.0B 0.0Bps 00:00 N)rÆ   r   rÂ   r   r   r¦   r   rô   rö   rù   r<   r›   rú   rû   s         r/   Útest_printProgressBarNoProgressz0StdioClientTests.test_printProgressBarNoProgressò  s¦   € ð 	× Ò   RÑ(Ô(Ð(Ý&+¡g¤gÐ-ˆ�”Ô#Ý˜$‘-”-ˆØ ˆŒÝÔ" 7Ñ+Ô+ˆØ—M’M‘O”Oˆ	àŒ×%Ò% g¨yÑ9Ô9Ð9à6ˆØ×Ò˜œÔ.×4Ò4Ñ6Ô6¸Ñ?Ô?Ð?Ð?Ð?r1   c                 ó"  — |                       dd¦  «         t          ¦   «         }d|_        t          j        |¦  «        }| j                             |d¦  «         d}|                      || j        j         	                    ¦   «         ¦  «         dS )z5
        Print the progress for empty files.
        r˜   rñ   s
   empty-filer   s%   b'empty-file'100% 0.0B 0.0Bps 00:00 N)
rÆ   r   r¦   r   rô   rÂ   rù   r<   r›   rú   )r.   rý   rþ   r   s       r/   Útest_printProgressBarEmptyFilez/StdioClientTests.test_printProgressBarEmptyFile  s„   € ð 	× Ò   RÑ(Ô(Ð(Ý‘)”)ˆØ$ˆŒÝÔ" 7Ñ+Ô+ˆàŒ×%Ò% g¨qÑ1Ô1Ð1à:ˆØ×Ò˜ ¤Ô!6×!<Ò!<Ñ!>Ô!>Ñ?Ô?Ð?Ð?Ð?r1   c                 óf   — | j                              d¦  «        }|                      d|¦  «         dS )zK
        Returns empty value for both filename and remaining data.
        z  )rØ   rØ   N©rÂ   Ú_getFilenamer<   ©r.   r   s     r/   Útest_getFilenameEmptyz&StdioClientTests.test_getFilenameEmpty  s5   € ð ”×)Ò)¨$Ñ/Ô/ˆà×Ò˜ 6Ñ*Ô*Ð*Ð*Ð*r1   c                 óf   — | j                              d¦  «        }|                      d|¦  «         dS )zd
        Returns empty value for remaining data when line contains
        only a filename.
        ú
only-local)r  rØ   Nr  r	  s     r/   Útest_getFilenameOnlyLocalz*StdioClientTests.test_getFilenameOnlyLocal  s6   € ð
 ”×)Ò)¨,Ñ7Ô7ˆà×ÒÐ+¨VÑ4Ô4Ð4Ð4Ð4r1   c                 óf   — | j                              d¦  «        }|                      d|¦  «         dS )ze
        Returns filename and remaining data striped of leading and trailing
        spaces.
        z local  remote file  )Úlocalzremote fileNr  r	  s     r/   Útest_getFilenameNotQuotedz*StdioClientTests.test_getFilenameNotQuoted#  s7   € ð
 ”×)Ò)Ð*AÑBÔBˆà×ÒÐ1°6Ñ:Ô:Ð:Ð:Ð:r1   c                 óf   — | j                              d¦  «        }|                      d|¦  «         dS )z‰
        Returns filename and remaining data not striped of leading and trailing
        spaces when quoted paths are requested.
        z" " local file "  " remote  file " )z local file z" remote  file "Nr  r	  s     r/   Útest_getFilenameQuotedz'StdioClientTests.test_getFilenameQuoted,  s7   € ð
 ”×)Ò)Ð*NÑOÔOˆà×ÒÐ=¸vÑFÔFÐFÐFÐFr1   Nr1   c                 ó¬   — |€|                       ¦   «         }t          |d¦  «        5 }|                     |¦  «         ddd¦  «         n# 1 swxY w Y   |S )ab  
        Create a local file and return its path.

        When `path` is L{None}, it will create a new temporary file.

        @param path: Optional path for the new file.
        @type path: L{str}

        @param content: Content to be written in the new file.
        @type content: L{bytes}

        @return: Path to the newly create file.
        NÚwb)ÚmktempÚopenr©   )r.   rŽ   ÚcontentÚfiles       r/   ÚmakeFilezStdioClientTests.makeFile5  s�   € ð ˆ<Ø—;’;‘=”=ˆDÝ�$˜ÑÔð 	  Ø�JŠJ�wÑÔÐð	 ð 	 ð 	 ñ 	 ô 	 ð 	 ð 	 ð 	 ð 	 ð 	 ð 	 øøøð 	 ð 	 ð 	 ð 	 àˆs   §A	Á	AÁAFc                 óÚ  — | j         j                             ¦   «         }|                     d¦  «        }|                     d¦  «        }g }g }|D �]­\  }}}g }	|D ]}
|	                     |› d|
› �¦  «         Œ|	                     d|› d|› �¦  «         |                     |	¦  «         |                     d¦  «                             d¦  «                             d¦  «        }|dd	…         }|d	                              d
¦  «                             d
¦  «        }|                     |¦  «         g }|dd	…         D ]�}
|
                     ¦   «          	                    dd¦  «        d         }
|
                     ¦   «                              dd¦  «        }
|                     |
d         › d|
d                              ¦   «         › �¦  «         Œ‘|                     |d	         ¦  «         |                     |¦  «         �Œ¯|r1|  
                    t          |¦  «        t          |¦  «        ¦  «         n|  
                    ||¦  «         |  
                    dt          |¦  «        d¦  «         dS )a  
        Check output of cftp client for a put request.


        @param transfers: List with tuple of (local, remote, progress).
        @param randomOrder: When set to C{True}, it will ignore the order
            in which put reposes are received

        r8   z
ú zTransferred z to r   úNéÿÿÿÿú
é   r—   z5There are still put responses which were not checked.)rÂ   r›   rú   ÚdecodeÚsplitÚappendr“   ÚstripÚextendÚrsplitr<   ÚsortedÚlen)r.   Ú	transfersÚrandomOrderÚoutputÚexpectedOutputÚactualOutputr  ÚremoteÚexpectedÚexpectedTransferÚlineÚprogressPartsÚactualÚlastÚactualTransfers                  r/   ÚcheckPutMessagez StdioClientTests.checkPutMessageI  s‚  € ð ”Ô&×,Ò,Ñ.Ô.ˆØ—’˜wÑ'Ô'ˆØ—’˜fÑ%Ô%ˆàˆØˆà'0ð 	0ñ 	0Ñ#ˆE�6˜8ð  "ÐØ ð ;ð ;�Ø ×'Ò'¨5Ð(9Ð(9°4Ð(9Ð(9Ñ:Ô:Ð:Ð:Ø×#Ò#Ð$F°5Ð$FÐ$F¸fÐ$FÐ$FÑGÔGÐGØ×!Ò!Ð"2Ñ3Ô3Ð3à"ŸJšJ q™MœM×/Ò/°Ñ5Ô5×;Ò;¸DÑAÔAˆMØ" 3 B 3Ô'ˆFà  Ô$×*Ò*¨4Ñ0Ô0×6Ò6°tÑ<Ô<ˆDØ�MŠM˜$ÑÔÐàˆNð ˜s ˜sœð Fð F�ð —z’z‘|”|×*Ò*¨3°Ñ2Ô2°1Ô5�ð —z’z‘|”|×)Ò)¨#¨qÑ1Ô1�Ø×%Ò%¨¨a¬Ð&DÐ&D°4¸´7·=²=±?´?Ð&DÐ&DÑEÔEÐEÐEØ×!Ò! &¨¤*Ñ-Ô-Ð-Ø×Ò Ñ/Ô/Ð/Ñ/àð 	;Ø×Ò�V NÑ3Ô3µV¸LÑ5IÔ5IÑJÔJÐJÐJà×Ò˜^¨\Ñ:Ô:Ð:à×ÒØÝ�‰KŒKØCñ	
ô 	
ð 	
ð 	
ð 	
r1   c                 ó¶  — d}|                       |¬¦  «        }t          j        t          j        z  t          j        z  }t
          j                             dt
          j                             |¦  «        ¦  «        }t          |¦  «        }| j
                             ||t          j        |¦  «        ¦  «         d| j        j        j        d<   | j                             |¦  «        }|                      |¦  «         |                      ||                     ¦   «         ¦  «         |                      |j        ¦  «         |                      ||g d¢fg¦  «         dS )z�
        A name based on local path is used when remote path is not
        provided.

        The progress is updated while chunks are transferred.
        s   Test
Content)r  r¾   r˜   rš   )z	76% 10.0Bú
100% 13.0Br7  N)r  r   Ú	FXF_WRITEÚ	FXF_CREATÚ	FXF_TRUNCrP   rŽ   ÚjoinÚbasenamer¤   rÀ   r‘   r   rª   rÂ   rœ   Úcmd_PUTÚsuccessResultOfr<   r=   r4   r¯   r5  )r.   r  Ú	localPathr�   Ú
remoteNameÚ
remoteFileÚdeferreds          r/   Útest_cmd_PUTSingleNoRemotePathz/StdioClientTests.test_cmd_PUTSingleNoRemotePath†  s3  € ð %ˆØ—M’M¨'�MÑ2Ô2ˆ	ÝÔ&­Ô)?Ñ?Å,ÔBXÑXˆÝ”W—\’\ #¥r¤w×'7Ò'7¸	Ñ'BÔ'BÑCÔCˆ
Ý'¨
Ñ3Ô3ˆ
ØÔ×Ò 
¨Eµ5´=ÀÑ3LÔ3LÑMÔMÐMØ35ˆŒÔÔ" <Ñ0à”;×&Ò& yÑ1Ô1ˆØ×Ò˜XÑ&Ô&Ð&à×Ò˜ *×"5Ò"5Ñ"7Ô"7Ñ8Ô8Ð8Ø�Š˜
Ô*Ñ+Ô+Ð+Ø×ÒØ˜Ð%NÐ%NÐ%NÐOÐPñ	
ô 	
ð 	
ð 	
ð 	
r1   c                 ó  — |                       ¦   «         }t          j        t          j        z  t          j        z  }d}t          |¦  «        }| j                             ||t          j	        |¦  «        ¦  «         | j
                             |› d|› d�¦  «        }|                      |¦  «         |                      ||dgfg¦  «         |                      |j        ¦  «         |                      d|                     ¦   «         ¦  «         dS )z€
        Remote path is extracted from first filename after local file.

        Any other data in the line is ignored.
        z/remote-pathr  z ignoredú	100% 0.0Br1   N)r  r   r8  r9  r:  r¤   rÀ   r‘   r   rª   rÂ   r=  r>  r5  r4   r¯   r<   r=   )r.   r?  r�   r@  rA  rB  s         r/   Útest_cmd_PUTSingleRemotePathz-StdioClientTests.test_cmd_PUTSingleRemotePathž  s÷   € ð —M’M‘O”Oˆ	ÝÔ&­Ô)?Ñ?Å,ÔBXÑXˆØ#ˆ
Ý'¨
Ñ3Ô3ˆ
ØÔ×Ò 
¨Eµ5´=ÀÑ3LÔ3LÑMÔMÐMà”;×&Ò&¨)Ð'JÐ'J°jÐ'JÐ'JÐ'JÑKÔKˆØ×Ò˜XÑ&Ô&Ð&à×Ò˜y¨*°{°mÐDÐEÑFÔFÐFØ�Š˜
Ô*Ñ+Ô+Ð+Ø×Ò˜˜j×1Ò1Ñ3Ô3Ñ4Ô4Ð4Ð4Ð4r1   c                 óN  — |                       ¦   «         }t          j                             |¦  «        }d}t          j                             |¦  «        }|                       t          j                             ||¦  «        ¬¦  «        }t          j        t          j        z  t          j	        z  }d|› �}d|› �}t          |¦  «        }	t          |¦  «        }
| j                             ||t          j        |	¦  «        ¦  «         | j                             ||t          j        |
¦  «        ¦  «         | j                             t          j                             |d¦  «        ¦  «        }|                      |¦  «         |                      |	j        ¦  «         |                      d|	                     ¦   «         ¦  «         |                      |
j        ¦  «         |                      d|
                     ¦   «         ¦  «         |                      ||dgf||dgfgd¬¦  «         d	S )
z„
        When a gobbing expression is used local files are transferred with
        remote file names based on local names.
        úsecond-name©rŽ   r¾   Ú*r1   rE  T©r)  N)r  rP   rŽ   r<  Údirnamer;  r   r8  r9  r:  r¤   rÀ   r‘   r   rª   rÂ   r=  r>  r4   r¯   r<   r=   r5  )r.   ÚfirstÚ	firstNameÚ
secondNameÚparentÚsecondr�   ÚfirstRemotePathÚsecondRemotePathÚfirstRemoteFileÚsecondRemoteFilerB  s               r/   Ú test_cmd_PUTMultipleNoRemotePathz1StdioClientTests.test_cmd_PUTMultipleNoRemotePath±  sõ  € ð
 —’‘”ˆÝ”G×$Ò$ UÑ+Ô+ˆ	Ø"ˆ
Ý”—’ Ñ'Ô'ˆØ—’¥B¤G§L¢L°¸Ñ$DÔ$D�ÑEÔEˆÝÔ&­Ô)?Ñ?Å,ÔBXÑXˆØ)˜i˜/˜/ˆØ+˜zÐ+Ð+ÐÝ,¨_Ñ=Ô=ˆÝ-Ð.>Ñ?Ô?ÐØÔ×Ò °½¼ÀoÑ8VÔ8VÑWÔWÐWØÔ×ÒØ˜e¥U¤]Ð3CÑ%DÔ%Dñ	
ô 	
ð 	
ð ”;×&Ò&¥r¤w§|¢|°F¸CÑ'@Ô'@ÑAÔAˆØ×Ò˜XÑ&Ô&Ð&à�Š˜Ô/Ñ0Ô0Ð0Ø×Ò˜˜o×6Ò6Ñ8Ô8Ñ9Ô9Ð9Ø�ŠÐ(Ô0Ñ1Ô1Ð1Ø×Ò˜Ð.×7Ò7Ñ9Ô9Ñ:Ô:Ð:Ø×Òà˜¨+¨Ð7ØÐ)¨K¨=Ð9ðð ð 	ñ 	
ô 	
ð 	
ð 	
ð 	
r1   c                 ót  — |                       ¦   «         }t          j                             |¦  «        }d}t          j                             |¦  «        }|                       t          j                             ||¦  «        ¬¦  «        }t          j        t          j        z  t          j	        z  }t          |¦  «        }t          |¦  «        }d|› �}	d|› �}
| j                             |	|t          j        |¦  «        ¦  «         | j                             |
|t          j        |¦  «        ¦  «         | j                             d                     t          j                             |d¦  «        ¦  «        ¦  «        }|                      |¦  «         |                      |j        ¦  «         |                      d|                     ¦   «         ¦  «         |                      |j        ¦  «         |                      d|                     ¦   «         ¦  «         |                      ||dgf||dgfgd¬	¦  «         d
S )zõ
        When a gobbing expression is used local files are transferred with
        remote file names based on local names.
        when a remote folder is requested remote paths are composed from
        remote path and local filename.
        rH  rI  z/remote/z	{} remoterJ  r1   rE  TrK  N)r  rP   rŽ   r<  rL  r;  r   r8  r9  r:  r¤   rÀ   r‘   r   rª   rÂ   r=  Úformatr>  r4   r¯   r<   r=   r5  )r.   rM  rN  rO  rP  rQ  r�   rT  rU  rR  rS  rB  s               r/   Ú"test_cmd_PUTMultipleWithRemotePathz3StdioClientTests.test_cmd_PUTMultipleWithRemotePathÔ  s  € ð —’‘”ˆÝ”G×$Ò$ UÑ+Ô+ˆ	Ø"ˆ
Ý”—’ Ñ'Ô'ˆØ—’¥B¤G§L¢L°¸Ñ$DÔ$D�ÑEÔEˆÝÔ&­Ô)?Ñ?Å,ÔBXÑXˆÝ,¨YÑ7Ô7ˆÝ-¨jÑ9Ô9ÐØ0 YÐ0Ð0ˆØ2 jÐ2Ð2ÐØÔ×Ò °½¼ÀoÑ8VÔ8VÑWÔWÐWØÔ×ÒØ˜e¥U¤]Ð3CÑ%DÔ%Dñ	
ô 	
ð 	
ð ”;×&Ò& {×'9Ò'9½"¼'¿,º,ÀvÈsÑ:SÔ:SÑ'TÔ'TÑUÔUˆØ×Ò˜XÑ&Ô&Ð&à�Š˜Ô/Ñ0Ô0Ð0Ø×Ò˜˜o×6Ò6Ñ8Ô8Ñ9Ô9Ð9Ø�ŠÐ(Ô0Ñ1Ô1Ð1Ø×Ò˜Ð.×7Ò7Ñ9Ô9Ñ:Ô:Ð:Ø×Òà˜	 K =Ð1Ø˜ k ]Ð3ðð ð 	ñ 	
ô 	
ð 	
ð 	
ð 	
r1   )Nr1   )F)rA   rB   rC   rD   r0   rÖ   rÛ   rÝ   rÆ   r  r  r  r
  r  r  r  r  r5  rC  rF  rV  rY  rE   r1   r/   r¼   r¼   †  sD  € € € € € ðð ð=ð =ð =ð&ð ð ðð ð ð
ð 
ð 
ð/ð /ð /ð*@ð @ð @ð0@ð @ð @ð$@ð @ð @ð+ð +ð +ð5ð 5ð 5ð;ð ;ð ;ðGð Gð Gðð ð ð ð(;
ð ;
ð ;
ð ;
ðz
ð 
ð 
ð05ð 5ð 5ð&!
ð !
ð !
ðF#
ð #
ð #
ð #
ð #
r1   r¼   c                   ó   — e Zd Zd„ Zd„ ZdS )ÚFileTransferTestRealmc                 ó   — || _         d S r(   )ÚtestDir)r.   r]  s     r/   r…   zFileTransferTestRealm.__init__û  s   € ØˆŒˆˆr1   c                 óB   — t          | j        ¦  «        }|d         |d„ fS )Nr   c                  ó   — d S r(   rE   rE   r1   r/   ú<lambda>z5FileTransferTestRealm.requestAvatar.<locals>.<lambda>   s   € ¨€ r1   )r	   r]  )r.   ÚavatarIDÚmindr   Úas        r/   ÚrequestAvatarz#FileTransferTestRealm.requestAvatarþ  s$   € Ý" 4¤<Ñ0Ô0ˆØ˜!Œ}˜a  Ð-Ð-r1   N)rA   rB   rC   r…   rd  rE   r1   r/   r[  r[  ú  s2   € € € € € ðð ð ð.ð .ð .ð .ð .r1   r[  c                   óN   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ ZdS )ÚSFTPTestProcessz³
    Protocol for testing cftp. Provides an interface between Python (where all
    the tests are) and the cftp client process (which does the work that is
    being tested).
    c                 óf   — |                       ¦   «          || _        d| _        d| _        d| _        dS )zr
        @param onOutReceived: A L{Deferred} to be fired as soon as data is
        received from stdout.
        NF)ÚclearBufferÚonOutReceivedÚonProcessEndÚ_expectingCommandÚ_processEnded)r.   ri  s     r/   r…   zSFTPTestProcess.__init__
  s<   € ð
 	×ÒÑÔÐØ*ˆÔØ ˆÔØ!%ˆÔØ"ˆÔÐÐr1   c                 ó0   — d| _         g | _        d| _        dS )zR
        Clear any buffered data received from stdout. Should be private.
        r1   N)ÚbufferÚ_linesReceivedÚ_lineBufferr-   s    r/   rh  zSFTPTestProcess.clearBuffer  s!   € ð ˆŒØ ˆÔØˆÔÐÐr1   c                 ót  — t          j        d|z  ¦  «         | j        |z                        d¦  «        }|                     d¦  «        | _        | j                             |¦  «         | j        �$| j        dc}| _        |                     |¦  «         | xj	        |z  c_	        |  
                    ¦   «          dS )zO
        Called by Twisted when the cftp client prints data to stdout.
        zgot %ró   
r  N)r   Úmsgrp  r!  r“   ro  r$  ri  Úcallbackrn  Ú_checkForCommand)r.   r¬   ÚlinesrÕ   s       r/   ÚoutReceivedzSFTPTestProcess.outReceived  s³   € õ 	Œ�˜4‘Ñ Ô Ð ØÔ! DÑ(×/Ò/°Ñ6Ô6ˆØ Ÿ9š9 R™=œ=ˆÔØÔ×"Ò" 5Ñ)Ô)Ð)ð ÔÐ)Ø$(Ô$6¸Ð!ˆAˆtÔ!Ø�JŠJ�tÑÔÐØˆŒ�tÑˆŒØ×ÒÑÔÐÐÐr1   c                 ó2  — d}| j         r‹| j        |k    r‚d                     | j        ¦  «        }|                     |¦  «        r|t          |¦  «        d …         }|                      ¦   «          | j         d c}| _         |                     |¦  «         d S d S d S )Ns   cftp> rr  )rk  rp  r;  ro  Ú
startswithr'  rh  rt  )r.   ÚpromptÚbufrÕ   s       r/   ru  z SFTPTestProcess._checkForCommand.  s¢   € ØˆØÔ!ð 	 dÔ&6¸&Ò&@Ð&@Ø—*’*˜TÔ0Ñ1Ô1ˆCØ�~Š~˜fÑ%Ô%ð )Ø�#˜f™+œ+˜-˜-Ô(�Ø×ÒÑÔÐØ(,Ô(>ÀÐ%ˆAˆtÔ%Ø�JŠJ�s‰OŒOˆOˆOˆOð	ð 	Ð&@Ð&@r1   c                 ó4   — t          j        d|z  ¦  «         dS )zO
        Called by Twisted when the cftp client prints data to stderr.
        zerr: %sN)r   rs  )r.   r¬   s     r/   ÚerrReceivedzSFTPTestProcess.errReceived8  s   € õ 	Œ�	˜DÑ Ñ!Ô!Ð!Ð!Ð!r1   c                 ó   — | j         S )zQ
        Return the contents of the buffer of data received from stdout.
        )rn  r-   s    r/   Ú	getBufferzSFTPTestProcess.getBuffer>  s   € ð Œ{Ðr1   c                 óö   — t          j        ¦   «         | _        |                      ¦   «          t	          |t
          ¦  «        r|                     d¦  «        }| j                             |dz   ¦  «         | j        S )a¬  
        Issue the given command via the cftp client. Return a C{Deferred} that
        fires when the server returns a result. Note that the C{Deferred} will
        callback even if the server returns some kind of error.

        @param command: A string containing an sftp command.

        @return: A C{Deferred} that fires when the sftp server returns a
        result. The payload is the server's response string.
        r8   rr  )	r   ÚDeferredrk  rh  Ú
isinstanceÚstrr:   r›   r©   ©r.   Úcommands     r/   Ú
runCommandzSFTPTestProcess.runCommandD  sl   € õ "'¤Ñ!1Ô!1ˆÔØ×ÒÑÔÐÝ�g�sÑ#Ô#ð 	.Ø—n’n WÑ-Ô-ˆGØŒ×Ò˜W u™_Ñ-Ô-Ð-ØÔ%Ð%r1   c                 ót   ‡ ‡— t          j        d¦  «        Šˆ ˆfd„|D ¦   «         }t          j        |¦  «        S )ax  
        Run each command in sequence and return a Deferred that fires when all
        commands are completed.

        @param commands: A list of strings containing sftp commands.

        @return: A C{Deferred} that fires when all commands are completed. The
        payload is a list of response strings from the server, in the same
        order as the commands.
        r—   c                 óF   •— g | ]}‰                      ‰j        |¦  «        ‘ŒS rE   )Úrunr†  )Ú.0r…  r.   Úsems     €€r/   ú
<listcomp>z-SFTPTestProcess.runScript.<locals>.<listcomp>b  s)   ø€ ÐHÐHÐH°Gˆc�gŠg�d”o wÑ/Ô/ÐHÐHÐHr1   )r   ÚDeferredSemaphoreÚgatherResults)r.   ÚcommandsÚdlr‹  s   `  @r/   Ú	runScriptzSFTPTestProcess.runScriptV  sC   øø€ õ Ô% aÑ(Ô(ˆØHÐHÐHÐHÐH¸xÐHÑHÔHˆÝÔ" 2Ñ&Ô&Ð&r1   c                 óª   — | j         rt          j        d¦  «        S t          j        ¦   «         | _        | j                             d¦  «         | j        S )zø
        Kill the process if it is still running.

        If the process is still running, sends a KILL signal to the transport
        and returns a C{Deferred} which fires when L{processEnded} is called.

        @return: a C{Deferred}.
        NÚKILL)rl  r   rª   r�  rj  r›   ÚsignalProcessr-   s    r/   ÚkillProcesszSFTPTestProcess.killProcesse  sN   € ð Ôð 	'Ý”= Ñ&Ô&Ð&Ý!œNÑ,Ô,ˆÔØŒ×$Ò$ VÑ,Ô,Ð,ØÔ Ð r1   c                 ón   — d| _         | j        r&| j        dc}| _        |                     d¦  «         dS dS )zF
        Called by Twisted when the cftp client process ends.
        TN)rl  rj  rt  )r.   ÚreasonrÕ   s      r/   ÚprocessEndedzSFTPTestProcess.processEndedt  sK   € ð "ˆÔØÔð 	Ø#'Ô#4°dÐ ˆAˆtÔ Ø�JŠJ�tÑÔÐÐÐð	ð 	r1   N)rA   rB   rC   rD   r…   rh  rw  ru  r}  r  r†  r‘  r•  r˜  rE   r1   r/   rf  rf    s´   € € € € € ðð ð	#ð 	#ð 	#ðð ð ð ð  ð  ð"ð ð ð"ð "ð "ðð ð ð&ð &ð &ð$'ð 'ð 'ð!ð !ð !ðð ð ð ð r1   rf  c                   ó,   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )ÚCFTPClientTestBasec                 ó  — t          dd¦  «        5 }|                     t          j        ¦  «         d d d ¦  «         n# 1 swxY w Y   t          dd¦  «        5 }|                     t          j        ¦  «         d d d ¦  «         n# 1 swxY w Y   t          j        dd¦  «         t          dd¦  «        5 }|                     dt          j        z   ¦  «         d d d ¦  «         n# 1 swxY w Y   t          j	        | ¦  «        S )Núdsa_test.pubr  Údsa_testi€�  Úkh_tests
   127.0.0.1 )
r  r©   r!   ÚpublicDSA_opensshÚprivateDSA_opensshrP   ÚchmodÚpublicRSA_opensshr
   r0   ©r.   Úfs     r/   r0   zCFTPClientTestBase.setUp  sŸ  € Ý�. $Ñ'Ô'ð 	0¨1Ø�GŠG•HÔ.Ñ/Ô/Ð/ð	0ð 	0ð 	0ñ 	0ô 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0øøøð 	0ð 	0ð 	0ð 	0å�*˜dÑ#Ô#ð 	1 qØ�GŠG•HÔ/Ñ0Ô0Ð0ð	1ð 	1ð 	1ñ 	1ô 	1ð 	1ð 	1ð 	1ð 	1ð 	1ð 	1øøøð 	1ð 	1ð 	1ð 	1å
Œ�˜UÑ#Ô#Ð#Ý�)˜TÑ"Ô"ð 	@ aØ�GŠG�M¥HÔ$>Ñ>Ñ?Ô?Ð?ð	@ð 	@ð 	@ñ 	@ô 	@ð 	@ð 	@ð 	@ð 	@ð 	@ð 	@øøøð 	@ð 	@ð 	@ð 	@åÔ! $Ñ'Ô'Ð's3   ‘ =½AÁAÁ BÂBÂBÂ4#C#Ã#C'Ã*C'c                 ó  — t          | j        ¦  «        }t          j        |¦  «        }|                     t          j        ¦   «         ¦  «         t          j        ¦   «         }||_        t          j	        d|d¬¦  «        | _
        d S )Nr   z	127.0.0.1)Ú	interface)r[  r]  r   ÚPortalÚregisterCheckerr!   ÚconchTestPublicKeyCheckerÚConchTestServerFactoryr   Ú	listenTCPÚserver)r.   ÚrealmÚpÚfacs       r/   ÚstartServerzCFTPClientTestBase.startServer‰  so   € Ý% d¤lÑ3Ô3ˆÝŒM˜%Ñ Ô ˆØ	×Ò�(Ô<Ñ>Ô>Ñ?Ô?Ð?ÝÔ-Ñ/Ô/ˆØˆŒ
ÝÔ'¨¨3¸+ÐFÑFÔFˆŒˆˆr1   c                 ó  — t          | j        j        d¦  «        s|                      d ¦  «        S d| j        j        j        _        t          j        | j        j        j        j        j	        ¦  «        }| 
                    | j        ¦  «         |S )NÚprotor—   )Úhasattrr¬  ÚfactoryÚ_cbStopServerr²  ÚexpectedLoseConnectionr   ÚmaybeDeferredr›   ÚloseConnectionrÓ   rÔ   s     r/   Ú
stopServerzCFTPClientTestBase.stopServer‘  su   € Ý�t”{Ô*¨GÑ4Ô4ð 	,Ø×%Ò% dÑ+Ô+Ð+Ø;<ˆŒÔÔ!Ô8ÝÔ ¤Ô 3Ô 9Ô CÔ RÑSÔSˆØ	�Š�dÔ(Ñ)Ô)Ð)Øˆr1   c                 ó>   — t          j        | j        j        ¦  «        S r(   )r   r·  r¬  ÚstopListening©r.   Úignoreds     r/   rµ  z CFTPClientTestBase._cbStopServer™  s   € ÝÔ" 4¤;Ô#<Ñ=Ô=Ð=r1   c                 ó~   — dD ]'}	 t          j        |¦  «         Œ# t          $ r Y Œ$w xY wt          j        | ¦  «        S )N)rœ  r�  rž  )rP   ÚremoveÚBaseExceptionr
   ÚtearDownr£  s     r/   rÁ  zCFTPClientTestBase.tearDownœ  sV   € Ø8ð 	ð 	ˆAðÝ”	˜!‘”��øÝ ð ð ð Ø�ðøøøåÔ$ TÑ*Ô*Ð*s   †›
(§(N)rA   rB   rC   r0   r°  r¹  rµ  rÁ  rE   r1   r/   rš  rš  ~  sb   € € € € € ð(ð (ð (ðGð Gð Gðð ð ð>ð >ð >ð+ð +ð +ð +ð +r1   rš  c                   ó’   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zdd„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )ÚOurServerCmdLineClientTestszí
    Functional tests which launch a SFTP server over TCP on localhost and check
    cftp command line interface using a spawned process.

    Due to the spawned process you can not add a debugger breakpoint for the
    client code.
    c                 óN  ‡ — t                                ‰ ¦  «         ‰                      ¦   «          d}‰ j                             ¦   «         j        }t          j        ||z                       ¦   «         d¬¦  «        }t          j
        dt          j        › d|› �¦  «         t          j        ¦   «         }t          |¦  «        ‰ _        |                     ˆ fd„¦  «         t$          j                             ¦   «         }t$          j                             t          j        ¦  «        |d<   g }i }|D ]A}t1          |t2          ¦  «        r|                     d¦  «        }|                     |¦  «         ŒB|D ]c}||         }	t1          |t2          ¦  «        r|                     d¦  «        }t1          |	t2          ¦  «        r|	                     d¦  «        }	|	||<   Œdt          j
        |¦  «         t          j
        |¦  «         t9          j        ‰ j        t          j        ||¬	¦  «         |S )
Nz‚-p %i -l testuser --known-hosts kh_test --user-authentications publickey --host-key-algorithms ssh-rsa -i dsa_test -a -v 127.0.0.1r   ©Úmodúrunning r  c                 ó6   •— ‰j                              ¦   «         S r(   )ÚprocessProtocolrh  ©Ú_r.   s    €r/   r`  z3OurServerCmdLineClientTests.setUp.<locals>.<lambda>Â  ó   ø€  Ô 4× @Ò @Ñ BÔ B€ r1   Ú
PYTHONPATHr8   ©Úenv)rš  r0   r°  r¬  ÚgetHostÚportr    Ú	_makeArgsr!  r   rs  rÐ   rÑ   r   r�  rf  rÉ  rÓ   rP   rQ   ÚcopyÚpathsepr;  rŽ   r‚  rƒ  r:   r"  r   ÚspawnProcess)
r.   ÚcmdsrÑ  rÕ   rÏ  ÚencodedCmdsÚ
encodedEnvÚcmdÚvarÚvals
   `         r/   r0   z!OurServerCmdLineClientTests.setUp¯  s  ø€ Ý× Ò  Ñ&Ô&Ð&à×ÒÑÔÐðð 	ð Œ{×"Ò"Ñ$Ô$Ô)ˆÝÔ# T¨D¡[×$7Ò$7Ñ$9Ô$9¸vÐFÑFÔFˆÝŒÐ2�3œ>Ð2Ð2¨DÐ2Ð2Ñ3Ô3Ð3ÝŒNÑÔˆÝ.¨qÑ1Ô1ˆÔØ	�ŠÐBÐBÐBÐBÑCÔCÐCÝŒj�oŠoÑÔˆÝœJŸOšO­C¬HÑ5Ô5ˆˆLÑØˆØˆ
Øð 	$ð 	$ˆCÝ˜#�sÑ#Ô#ð *Ø—j’j Ñ)Ô)�Ø×Ò˜sÑ#Ô#Ð#Ð#Øð 	"ð 	"ˆCØ�c”(ˆCÝ˜#�sÑ#Ô#ð *Ø—j’j Ñ)Ô)�Ý˜#�sÑ#Ô#ð *Ø—j’j Ñ)Ô)�Ø!ˆJ�s‰OˆOÝŒ�ÑÔÐÝŒ�
ÑÔÐÝÔØÔ ¥#¤.°+À:ð	
ñ 	
ô 	
ð 	
ð ˆr1   c                 ó`   ‡ — ‰                       ¦   «         }|                     ˆ fd„¦  «         |S )Nc                 ó6   •— ‰j                              ¦   «         S r(   )rÉ  r•  rÊ  s    €r/   r`  z6OurServerCmdLineClientTests.tearDown.<locals>.<lambda>Û  rÌ  r1   )r¹  rÓ   rÔ   s   ` r/   rÁ  z$OurServerCmdLineClientTests.tearDownÙ  s3   ø€ Ø�OŠOÑÔˆØ	�ŠÐBÐBÐBÐBÑCÔCÐCØˆr1   c                 ór   — 	 | j         j                             d¦  «         d S # t          j        $ r Y d S w xY w)Nr“  )rÉ  r›   r”  r   ÚProcessExitedAlreadyr¼  s     r/   Ú_killProcessz(OurServerCmdLineClientTests._killProcessÞ  sL   € ð	ØÔ Ô*×8Ò8¸Ñ@Ô@Ð@Ð@Ð@øÝÔ)ð 	ð 	ð 	ØˆDˆDð	øøøs   ‚# £6µ6c                 ó6   — | j                              |¦  «        S )z¼
        Run the given command with the cftp client. Return a C{Deferred} that
        fires when the command is complete. Payload is the server's output for
        that command.
        )rÉ  r†  r„  s     r/   r†  z&OurServerCmdLineClientTests.runCommandä  s   € ð Ô#×.Ò.¨wÑ7Ô7Ð7r1   c                 ó6   — | j                              |¦  «        S )zÓ
        Run the given commands with the cftp client. Returns a C{Deferred}
        that fires when the commands are all complete. The C{Deferred}'s
        payload is a list of output for each command.
        )rÉ  r‘  )r.   r�  s     r/   r‘  z%OurServerCmdLineClientTests.runScriptì  s   € ð Ô#×-Ò-¨hÑ7Ô7Ð7r1   c                 óê   — | j         }|                      ddddd¦  «        }d„ }|                     |¦  «         |                     | j        |j        t          j        ¦   «         d|j        g¦  «         |S )zý
        Test that 'pwd' reports the current remote directory, that 'lpwd'
        reports the current local directory, and that changing to a
        subdirectory then changing to its parent leaves you in the original
        remote directory.
        ÚpwdÚlpwdzcd testDirectoryúcd ..c                 ó¸   — g }| D ]A}t          |t          ¦  «        r|                     d¦  «        }|                     |¦  «         ŒB|dd…         |dd…         z   S )zH
            Callback function for handling command output.
            r8   Né   é   )r‚  Úbytesr   r"  )r*  rÖ  rÙ  s      r/   Ú	cmdOutputz8OurServerCmdLineClientTests.testCdPwd.<locals>.cmdOutputÿ  sk   € ð ˆDØð !ð !�Ý˜c¥5Ñ)Ô)ð .ØŸ*š* WÑ-Ô-�CØ—’˜CÑ Ô Ð Ð Ø˜˜˜”8˜d 1 2 2œhÑ&Ð&r1   rØ   )r]  r‘  rÓ   r<   rŽ   rP   Úgetcwd)r.   ÚhomeDirrÕ   rë  s       r/   Ú	testCdPwdz%OurServerCmdLineClientTests.testCdPwdô  sw   € ð ”,ˆØ�NŠN˜5 &Ð*<¸gÀuÑMÔMˆð		'ð 		'ð 		'ð 	
�Š�iÑ Ô Ð Ø	�Š�dÔ&¨¬µr´y±{´{ÀBÈÌÐ(UÑVÔVÐVØˆr1   c                 óh   ‡ — ˆ fd„}‰                       dddd¦  «        }|                     |¦  «        S )zŒ
        Check that 'ls -l' output includes the access permissions and that
        this output changes appropriately with 'chmod'.
        c                 óf  •— ‰                      ¦   «          ‰                     | d                              d¦  «        ¦  «         ‰                     | d         d¦  «         ‰                     | d                              d¦  «        | d         ¦  «         ‰                     | d         d¦  «         d S )Nr   s
   -rw-r--r--r—   r1   r  s
   ----------rè  )ÚflushLoggedErrorsr4   ry  r<   ©Úresultsr.   s    €r/   Ú_checkz7OurServerCmdLineClientTests.testChAttrs.<locals>._check  s�   ø€ Ø×"Ò"Ñ$Ô$Ð$Ø�OŠO˜G AœJ×1Ò1°-Ñ@Ô@ÑAÔAÐAØ×Ò˜W QœZ¨Ñ-Ô-Ð-Ø�OŠO˜G AœJ×1Ò1°-Ñ@Ô@À'È!Ä*ÑMÔMÐMØ×Ò˜W QœZ¨Ñ-Ô-Ð-Ð-Ð-r1   zls -l testfile1zchmod 0 testfile1zchmod 644 testfile1©r‘  rÓ   ©r.   rô  rÕ   s   `  r/   ÚtestChAttrsz'OurServerCmdLineClientTests.testChAttrs  sQ   ø€ ð	.ð 	.ð 	.ð 	.ð 	.ð �NŠNØØØØ!ñ	
ô 
ˆð �}Š}˜VÑ$Ô$Ð$r1   c                 óÊ   ‡ — ˆ fd„}‰                       dd‰ j                             ¦   «         z   ddd¦  «        }|                     d„ ¦  «         |                     |¦  «        S )zŽ
        Check 'ls' works as expected. Checks for wildcards, hidden files,
        listing directories and listing empty directories.
        c                 ó2  •— ‰                      | d         g d¢¦  «         ‰                      | d         g d¢¦  «         ‰                      | d         ddg¦  «         ‰                      | d         g d¢¦  «         ‰                      | d	         d
g¦  «         d S )Nr   ©s   testDirectoryó   testRemoveFileó   testRenameFiles	   testfile1r—   r  rû  rü  rè  )s   .testHiddenFilerû  rü  ré  r1   ©r<   rò  s    €r/   rô  z4OurServerCmdLineClientTests.testList.<locals>._check*  sÄ   ø€ Ø×ÒØ˜”
ØVÐVÐVñô ð ð ×ÒØ˜”
ØVÐVÐVñô ð ð ×Ò˜W QœZÐ*;Ð=NÐ)OÑPÔPÐPØ×ÒØ˜”
ÐVÐVÐVñô ð ð ×Ò˜W QœZ¨#¨Ñ/Ô/Ð/Ð/Ð/r1   r   zls ../zls *Filezls -a *Filezls -l testDirectoryc                 ó   — d„ | D ¦   «         S )Nc                 ó8   — g | ]}|                      d ¦  «        ‘ŒS )rr  )r!  )rŠ  Úxs     r/   rŒ  zJOurServerCmdLineClientTests.testList.<locals>.<lambda>.<locals>.<listcomp>@  s"   € Ð!=Ð!=Ð!=°Q !§'¢'¨%¡.¤.Ð!=Ð!=Ð!=r1   rE   )Úxss    r/   r`  z6OurServerCmdLineClientTests.testList.<locals>.<lambda>@  s   € Ð!=Ð!=¸"Ð!=Ñ!=Ô!=€ r1   )r‘  r]  r<  rÓ   rö  s   `  r/   ÚtestListz$OurServerCmdLineClientTests.testList$  s}   ø€ ð	0ð 	0ð 	0ð 	0ð 	0ð �NŠNØØ�t”|×,Ò,Ñ.Ô.Ñ.ØØØ!ñ
ô 
ˆð 	
�ŠÐ=Ð=Ñ>Ô>Ð>Ø�}Š}˜VÑ$Ô$Ð$r1   c                 ó,  — |                       d¦  «        }t          j        d¦  «                             d¦  «                             ¦   «         }t          |t          ¦  «        r|                     d¦  «        }|                     | j	        |¦  «         |S )zB
        Check that running the '?' command returns help.
        ú?NrØ   r8   )
r†  r   rÁ   Úcmd_HELPr#  r‚  rƒ  r:   rÓ   r<   )r.   rÕ   ÚhelpTexts      r/   ÚtestHelpz$OurServerCmdLineClientTests.testHelpC  s~   € ð �OŠO˜CÑ Ô ˆåÔ# DÑ)Ô)×2Ò2°2Ñ6Ô6×<Ò<Ñ>Ô>ˆÝ�h¥Ñ$Ô$ð 	0Ø—’ wÑ/Ô/ˆHØ	�Š�dÔ&¨Ñ1Ô1Ð1Øˆr1   Nc                 ó|   — |                       |                     ¦   «         |                     ¦   «         |¦  «         dS )zg
        Assert that the files at C{name1} and C{name2} contain exactly the
        same data.
        N)r<   Ú
getContent)r.   Úname1Úname2rs  s       r/   ÚassertFilesEqualz,OurServerCmdLineClientTests.assertFilesEqualO  s:   € ð
 	×Ò˜×)Ò)Ñ+Ô+¨U×-=Ò-=Ñ-?Ô-?ÀÑEÔEÐEÐEÐEr1   c                 ó^  ‡ ‡— d                      ‰ j        j        ‰ j        j        ¦  «        Št          ‰t          ¦  «        r‰                     d¦  «        Šˆˆ fd„}‰                      d‰ j        j        › d�¦  «        }|                     |¦  «         |                     ˆ fd„¦  «         |S )z³
        Test that 'get' saves the remote file to the correct local location,
        that the output of 'get' is correct and that 'rm' actually removes
        the file.
        z)Transferred {}/testfile1 to {}/test file2r8   c                 ó  •— ‰                      |                      ‰¦  «        ¦  «         ‰                     ‰j                             d¦  «        ‰j                             d¦  «        d¦  «         ‰                     d¦  «        S )NÚ	testfile1ú
test file2z
get failedzrm "test file2")r4   Úendswithr  r]  Úchildr†  ©r   r+  r.   s    €€r/   Ú	_checkGetz6OurServerCmdLineClientTests.testGet.<locals>._checkGetd  sw   ø€ Ø�OŠO˜FŸOšO¨NÑ;Ô;Ñ<Ô<Ð<Ø×!Ò!Ø”×"Ò" ;Ñ/Ô/Ø”×"Ò" <Ñ0Ô0Øñô ð ð
 —?’?Ð#4Ñ5Ô5Ð5r1   zget testfile1 "z/test file2"c                 ó‚   •— ‰                      ‰j                             d¦  «                             ¦   «         ¦  «        S )Nr  ©ÚassertFalser]  r  ÚexistsrÊ  s    €r/   r`  z5OurServerCmdLineClientTests.testGet.<locals>.<lambda>p  ó1   ø€ �d×&Ò& t¤|×'9Ò'9¸,Ñ'GÔ'G×'NÒ'NÑ'PÔ'PÑQÔQ€ r1   )rX  r]  rŽ   r‚  rƒ  r:   r†  rÓ   )r.   r  rÕ   r+  s   `  @r/   ÚtestGetz#OurServerCmdLineClientTests.testGetV  sÐ   øø€ ð E×KÒKØŒLÔØŒLÔñ
ô 
ˆõ �n¥cÑ*Ô*ð 	<Ø+×2Ò2°7Ñ;Ô;ˆNð	6ð 	6ð 	6ð 	6ð 	6ð 	6ð �OŠOÐM¨d¬lÔ.?ÐMÐMÐMÑNÔNˆØ	�Š�iÑ Ô Ð Ø	�ŠØQÐQÐQÐQñ	
ô 	
ð 	
ð ˆr1   c                 ób   ‡ — ˆ fd„}‰                       d¦  «        }|                     |¦  «        S )zQ
        Test that 'get' works correctly when given wildcard parameters.
        c                 óø   •— ‰                      ‰j                             d¦  «        t          d¦  «        d¦  «         ‰                      ‰j                             d¦  «        t          d¦  «        d¦  «         d S )NÚtestRemoveFileútestRemoveFile get failedÚtestRenameFileútestRenameFile get failed)r  r]  r  r   )r½  r.   s    €r/   rô  z;OurServerCmdLineClientTests.testWildcardGet.<locals>._checky  s…   ø€ Ø×!Ò!Ø”×"Ò"Ð#3Ñ4Ô4ÝÐ)Ñ*Ô*Ø+ñô ð ð
 ×!Ò!Ø”×"Ò"Ð#3Ñ4Ô4ÝÐ)Ñ*Ô*Ø+ñô ð ð ð r1   z
get testR*)r†  rÓ   rö  s   `  r/   ÚtestWildcardGetz+OurServerCmdLineClientTests.testWildcardGett  sA   ø€ ð

	ð 
	ð 
	ð 
	ð 
	ð �OŠO˜LÑ)Ô)ˆØ�}Š}˜VÑ$Ô$Ð$r1   c                 óB  ‡ ‡— d‰ j                              ¦   «         j        z   dz   ‰ j                              ¦   «         j        z   dz   Šˆˆ fd„}‰                      d‰ j         j        › d�¦  «        }|                     |¦  «         |                     ˆ fd„¦  «         |S )z—
        Check that 'put' uploads files correctly and that they can be
        successfully removed. Also check the output of the put command.
        s   Transferred s   /testfile1 to s   /test"file2c                 ó
  •— ‰                      ‰j                             d¦  «        ‰j                             d¦  «        ¦  «         ‰                     |                      ‰¦  «        ¦  «         ‰                     d¦  «        S )Nr  ú
test"file2zrm "test\"file2")r  r]  r  r4   r  r†  r  s    €€r/   Ú	_checkPutz6OurServerCmdLineClientTests.testPut.<locals>._checkPut–  ss   ø€ Ø×!Ò!Ø”×"Ò" ;Ñ/Ô/°´×1CÒ1CÀLÑ1QÔ1Qñô ð ð �OŠO˜FŸOšO¨NÑ;Ô;Ñ<Ô<Ð<Ø—?’?Ð#6Ñ7Ô7Ð7r1   úput z/testfile1 "test\"file2"c                 ó‚   •— ‰                      ‰j                             d¦  «                             ¦   «         ¦  «        S )Nr$  r  rÊ  s    €r/   r`  z5OurServerCmdLineClientTests.testPut.<locals>.<lambda>   r  r1   )r]  ÚasBytesModerŽ   r†  rÓ   )r.   r%  rÕ   r+  s   `  @r/   ÚtestPutz#OurServerCmdLineClientTests.testPutˆ  sÑ   øø€ ð ØŒl×&Ò&Ñ(Ô(Ô-ñ.àñ ð Œl×&Ò&Ñ(Ô(Ô-ñ.ð ñ	ð 	ð	8ð 	8ð 	8ð 	8ð 	8ð 	8ð �OŠOÐO 4¤<Ô#4ÐOÐOÐOÑPÔPˆØ	�Š�iÑ Ô Ð Ø	�ŠØQÐQÐQÐQñ	
ô 	
ð 	
ð ˆr1   c                 óî  ‡ — ‰ j                              d¦  «                             d¬¦  «        5 }|                     d¦  «         ddd¦  «         n# 1 swxY w Y   ‰ j                              d¦  «                             d¬¦  «        5 }|                     d¦  «         ddd¦  «         n# 1 swxY w Y   ˆ fd„}‰                      d	‰ j         j        › d
�¦  «        }|                     |¦  «         |S )zb
        Check that 'put' uploads files correctly when overwriting a longer
        file.
        ÚshorterFileÚw©Úmodeó   aNÚ
longerFileó   bbc                 ó”   •— ‰                      ‰j                             d¦  «        ‰j                             d¦  «        ¦  «         d S )Nr+  r0  )r  r]  r  )r   r.   s    €r/   r%  zEOurServerCmdLineClientTests.test_putOverLongerFile.<locals>._checkPut¯  sJ   ø€ Ø×!Ò!Ø”×"Ò" =Ñ1Ô1°4´<×3EÒ3EÀlÑ3SÔ3Sñô ð ð ð r1   r&  z/shorterFile longerFile)r]  r  r  r©   r†  rŽ   rÓ   )r.   r¤  r%  rÕ   s   `   r/   Útest_putOverLongerFilez2OurServerCmdLineClientTests.test_putOverLongerFile¤  si  ø€ ð Œ\×Ò Ñ.Ô.×3Ò3¸Ð3Ñ=Ô=ð 	ÀØ�GŠG�D‰MŒMˆMð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	àŒ\×Ò Ñ-Ô-×2Ò2¸Ð2Ñ<Ô<ð 	ÀØ�GŠG�E‰NŒNˆNð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð	ð 	ð 	ð 	ð 	ð
 �OŠOÐM 4¤<Ô#4ÐMÐMÐMÑNÔNˆØ	�Š�iÑ Ô Ð Øˆs#   °AÁAÁAÂB-Â-B1Â4B1c                 óD  ‡ ‡— ‰ j                              d¦  «        Š‰                     ¦   «          ‰                     d¦  «                             d¬¦  «        5 }|                     d¦  «         ddd¦  «         n# 1 swxY w Y   ‰ j                              d¦  «                             d¬¦  «        5 }|                     d¦  «         ddd¦  «         n# 1 swxY w Y   ˆ ˆfd„}‰                      d	‰ j         j        › d
�¦  «        }|                     |¦  «         |S )z˜
        Check that 'put' uploads files correctly when overwriting a longer
        file and you use a wildcard to specify the files to upload.
        Údirr  r,  r-  r/  Nr1  c                 óŠ   •— ‰                      ‰                     d¦  «        ‰j                             d¦  «        ¦  «         d S )Nr  )r  r  r]  )r   r.   ÚsomeDirs    €€r/   r%  zMOurServerCmdLineClientTests.test_putMultipleOverLongerFile.<locals>._checkPutÅ  s;   ø€ Ø×!Ò! '§-¢-°Ñ"7Ô"7¸¼×9KÒ9KÈFÑ9SÔ9SÑTÔTÐTÐTÐTr1   r&  z/dir/*)r]  r  ÚcreateDirectoryr  r©   r†  rŽ   rÓ   )r.   r¤  r%  rÕ   r7  s   `   @r/   Útest_putMultipleOverLongerFilez:OurServerCmdLineClientTests.test_putMultipleOverLongerFile¸  s˜  øø€ ð ”,×$Ò$ UÑ+Ô+ˆØ×ÒÑ!Ô!Ð!Ø�]Š]˜6Ñ"Ô"×'Ò'¨SÐ'Ñ1Ô1ð 	°QØ�GŠG�D‰MŒMˆMð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	àŒ\×Ò Ñ'Ô'×,Ò,°#Ð,Ñ6Ô6ð 	¸!Ø�GŠG�E‰NŒNˆNð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð	Uð 	Uð 	Uð 	Uð 	Uð 	Uð �OŠOÐ< 4¤<Ô#4Ð<Ð<Ð<Ñ=Ô=ˆØ	�Š�iÑ Ô Ð Øˆs$   ÁA<Á<B ÂB Â5CÃCÃCc                 óº   ‡ — ˆ fd„}‰                       dd‰ j        j        › d�d‰ j                             ¦   «         z  ¦  «        }|                     |¦  «         |S )zÍ
        What happens if you issue a 'put' command and include a wildcard (i.e.
        '*') in parameter? Check that all files matching the wildcard are
        uploaded to the correct directory.
        c                 óÜ  •— ‰                      | d         d¦  «         ‰                      | d         d¦  «         ‰                     ‰j                             d¦  «        ‰j                             ¦   «                              d¦  «        d¦  «         ‰                     ‰j                             d¦  «        ‰j                             ¦   «                              d¦  «        d¦  «         d S )Nr   r1   r  r  r  r  r   )r<   r  r]  r  rP  rò  s    €r/   Úcheckz:OurServerCmdLineClientTests.testWildcardPut.<locals>.checkÓ  sá   ø€ Ø×Ò˜W QœZ¨Ñ-Ô-Ð-Ø×Ò˜W QœZ¨Ñ-Ô-Ð-à×!Ò!Ø”×"Ò"Ð#3Ñ4Ô4Ø”×#Ò#Ñ%Ô%×+Ò+Ð,<Ñ=Ô=Ø+ñô ð ð
 ×!Ò!Ø”×"Ò"Ð#3Ñ4Ô4Ø”×#Ò#Ñ%Ô%×+Ò+Ð,<Ñ=Ô=Ø+ñô ð ð ð r1   ræ  r&  z/testR*zcd %s)r‘  r]  rŽ   r<  rÓ   )r.   r<  rÕ   s   `  r/   ÚtestWildcardPutz+OurServerCmdLineClientTests.testWildcardPutÌ  sv   ø€ ð	ð 	ð 	ð 	ð 	ð �NŠNØØ-�4”<Ô$Ð-Ð-Ð-Ø�d”l×+Ò+Ñ-Ô-Ñ-ñ
ô 
ˆð
 	
�Š�eÑÔÐØˆr1   c                 óž   ‡ — ˆ fd„}‰                       dd¦  «        }|                     |¦  «         |                     ‰ j        d¦  «         |S )z 
        Test that 'ln' creates a file which appears as a link in the output of
        'ls'. Check that removing the new file succeeds without output.
        c                 óì   •— ‰                      ¦   «          ‰                     | d         d¦  «         ‰                     | d                              d¦  «        d¦  «         ‰                     d¦  «        S )Nr   r1   r—   ó   lzlink failedzrm testLink)rñ  r<   r4   ry  r†  rò  s    €r/   rô  z4OurServerCmdLineClientTests.testLink.<locals>._checkð  sg   ø€ Ø×"Ò"Ñ$Ô$Ð$Ø×Ò˜W QœZ¨Ñ-Ô-Ð-Ø�OŠO˜G AœJ×1Ò1°$Ñ7Ô7¸ÑGÔGÐGØ—?’? =Ñ1Ô1Ð1r1   zln testLink testfile1zls -l testLinkr1   ©r‘  rÓ   r<   rö  s   `  r/   ÚtestLinkz$OurServerCmdLineClientTests.testLinkê  sa   ø€ ð	2ð 	2ð 	2ð 	2ð 	2ð �NŠNÐ2Ð4DÑEÔEˆØ	�Š�fÑÔÐØ	�Š�dÔ&¨Ñ,Ô,Ð,Øˆr1   c                 óž   ‡ — ˆ fd„}‰                       dd¦  «        }|                     |¦  «         |                     ‰ j        d¦  «         |S )zV
        Test that we can create and remove directories with the cftp client.
        c                 óÂ   •— ‰                      | d         d¦  «         ‰                     | d                              d¦  «        ¦  «         ‰                     d¦  «        S )Nr   r1   r—   ó   dzrmdir testMakeDirectory)r<   r4   ry  r†  rò  s    €r/   rô  z?OurServerCmdLineClientTests.testRemoteDirectory.<locals>._check   sT   ø€ Ø×Ò˜W QœZ¨Ñ-Ô-Ð-Ø�OŠO˜G AœJ×1Ò1°$Ñ7Ô7Ñ8Ô8Ð8Ø—?’?Ð#<Ñ=Ô=Ð=r1   úmkdir testMakeDirectoryzls -l testMakeDirector?r1   rA  rö  s   `  r/   ÚtestRemoteDirectoryz/OurServerCmdLineClientTests.testRemoteDirectoryû  sa   ø€ ð
	>ð 	>ð 	>ð 	>ð 	>ð
 �NŠNÐ4Ð6OÑPÔPˆØ	�Š�fÑÔÐØ	�Š�dÔ&¨Ñ,Ô,Ð,Øˆr1   c                 óh   ‡ — ˆ fd„}‰                       dd¦  «        }|                     |¦  «         |S )z—
        Test that a C{mkdir} on an existing directory fails with the
        appropriate error, and doesn't log an useless error server side.
        c                 óx   •— ‰                      | d         d¦  «         ‰                      | d         d¦  «         d S )Nr   r1   r—   s   remote error 11: mkdir failedrý  rò  s    €r/   rô  zHOurServerCmdLineClientTests.test_existingRemoteDirectory.<locals>._check  s>   ø€ Ø×Ò˜W QœZ¨Ñ-Ô-Ð-Ø×Ò˜W QœZÐ)IÑJÔJÐJÐJÐJr1   rF  rõ  rö  s   `  r/   Útest_existingRemoteDirectoryz8OurServerCmdLineClientTests.test_existingRemoteDirectory
  sO   ø€ ð	Kð 	Kð 	Kð 	Kð 	Kð �NŠNÐ4Ð6OÑPÔPˆØ	�Š�fÑÔÐØˆr1   c                 óê   ‡ — ‰                       d‰ j        j        › d�¦  «        }|                     ‰ j        d¦  «         |                     ˆ fd„¦  «         |                     ‰ j        d¦  «         |S )zÂ
        Test that we can create a directory locally and remove it with the
        cftp client. This test works because the 'remote' server is running
        out of a local directory.
        zlmkdir z/testLocalDirectoryr1   c                 ó.   •— ‰                      d¦  «        S )Nzrmdir testLocalDirectory)r†  rÊ  s    €r/   r`  z@OurServerCmdLineClientTests.testLocalDirectory.<locals>.<lambda>   s   ø€  §¢Ð0JÑ KÔ K€ r1   )r†  r]  rŽ   rÓ   r<   rÔ   s   ` r/   ÚtestLocalDirectoryz.OurServerCmdLineClientTests.testLocalDirectory  sv   ø€ ð �OŠOÐL d¤lÔ&7ÐLÐLÐLÑMÔMˆØ	�Š�dÔ&¨Ñ,Ô,Ð,Ø	�ŠÐKÐKÐKÐKÑLÔLÐLØ	�Š�dÔ&¨Ñ,Ô,Ð,Øˆr1   c                 óž   ‡ — ˆ fd„}‰                       dd¦  «        }|                     |¦  «         |                     ‰ j        d¦  «         |S )z1
        Test that we can rename a file.
        c                 óž   •— ‰                      | d         d¦  «         ‰                      | d         d¦  «         ‰                     d¦  «        S )Nr   r1   r—   s	   testfile2zrename testfile2 testfile1)r<   r†  rò  s    €r/   rô  z6OurServerCmdLineClientTests.testRename.<locals>._check)  sJ   ø€ Ø×Ò˜W QœZ¨Ñ-Ô-Ð-Ø×Ò˜W QœZ¨Ñ6Ô6Ð6Ø—?’?Ð#?Ñ@Ô@Ð@r1   zrename testfile1 testfile2zls testfile?r1   rA  rö  s   `  r/   Ú
testRenamez&OurServerCmdLineClientTests.testRename$  se   ø€ ð
	Að 	Að 	Að 	Að 	Að
 �NŠNÐ7¸ÑHÔHˆØ	�Š�fÑÔÐØ	�Š�dÔ&¨Ñ,Ô,Ð,Øˆr1   r(   )rA   rB   rC   rD   r0   rÁ  rà  r†  r‘  rî  r÷  r  r  r  r  r!  r)  r3  r9  r=  rB  rG  rJ  rM  rP  rE   r1   r/   rÃ  rÃ  ¥  sc  € € € € € ðð ð(ð (ð (ðTð ð ð
ð ð ð8ð 8ð 8ð8ð 8ð 8ðð ð ð4%ð %ð %ð,%ð %ð %ð>
ð 
ð 
ðFð Fð Fð Fðð ð ð<%ð %ð %ð(ð ð ð8ð ð ð(ð ð ð(ð ð ð<ð ð ð"ð ð ðð ð ð
ð 
ð 
ðð ð ð ð r1   rÃ  c                   ó6   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	dS )	ÚOurServerBatchFileTestszm
    Functional tests which launch a SFTP server over localhost and checks csftp
    in batch interface.
    c                 ób   — t                                | ¦  «         |                      ¦   «          d S r(   ©rš  r0   r°  r-   s    r/   r0   zOurServerBatchFileTests.setUp;  s.   € Ý× Ò  Ñ&Ô&Ð&Ø×ÒÑÔÐÐÐr1   c                 ó^   — t                                | ¦  «         |                      ¦   «         S r(   )rš  rÁ  r¹  r-   s    r/   rÁ  z OurServerBatchFileTests.tearDown?  s&   € Ý×#Ò# DÑ)Ô)Ð)Ø�ŠÑ Ô Ð r1   c                 óê  ‡— |                       ¦   «         Št          ‰d¦  «        5 }|                     |¦  «         d d d ¦  «         n# 1 swxY w Y   | j                             ¦   «         j        }d|‰fz  }t          j        |                     ¦   «         d¬¦  «        dd …         }t          j
        dt          j        › d|› �¦  «         t          j                             ¦   «         }t          j                             t          j        ¦  «        |d<   d| j        j        _        t+          t          j        ||¬	¦  «        }ˆfd
„}|                     d„ ¦  «         |                     |¦  «         |S )Nr,  zˆ-p %i -l testuser --known-hosts kh_test --user-authentications publickey --host-key-algorithms ssh-rsa -i dsa_test -a -v -b %s 127.0.0.1r   rÅ  r—   rÇ  r  rÍ  rÎ  c                 ó0   •— t          j        ‰¦  «         | S r(   )rP   r¿  )ÚresÚfns    €r/   Ú_cleanupz9OurServerBatchFileTests._getBatchOutput.<locals>._cleanupZ  s   ø€ ÝŒI�b‰MŒMˆMØˆJr1   c                 ó   — | d         S )Nr   rE   )rX  s    r/   r`  z9OurServerBatchFileTests._getBatchOutput.<locals>.<lambda>^  s
   €  # a¤&€ r1   )r  r  r©   r¬  rÐ  rÑ  r    rÒ  r!  r   rs  rÐ   rÑ   rP   rQ   rÓ  rÔ  r;  rŽ   r´  r¶  r   rÓ   ÚaddBoth)	r.   r¤  ÚfprÑ  rÖ  rÏ  rÕ   rZ  rY  s	           @r/   Ú_getBatchOutputz'OurServerBatchFileTests._getBatchOutputC  s‹  ø€ Ø�[Š[‰]Œ]ˆÝ�"�c‰]Œ]ð 	˜bØ�HŠH�Q‰KŒKˆKð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	àŒ{×"Ò"Ñ$Ô$Ô)ˆð!ð �2ˆJñˆõ Ô# D§J¢J¡L¤L°fÐ=Ñ=Ô=¸a¸b¸bÔAˆÝŒÐ2�3œ>Ð2Ð2¨DÐ2Ð2Ñ3Ô3Ð3ÝŒj�oŠoÑÔˆÝœJŸOšO­C¬HÑ5Ô5ˆˆLÑà56ˆŒÔÔ2å$¥S¤^°T¸sÐCÑCÔCˆð	ð 	ð 	ð 	ð 	ð 	
�ŠÐ(Ð(Ñ)Ô)Ð)Ø	�	Š	�(ÑÔÐàˆs   ¦AÁAÁAc                 ój   ‡ — d}ˆ fd„}‰                       |¦  «        }|                     |¦  «         |S )zš
        Test whether batch file function of cftp ('cftp -b batchfile').
        This works by treating the file as a list of commands to be run.
        zpwd
ls
exit
c                 ó*  •— |                       d¦  «        } t          j        dt          | ¦  «        z  ¦  «         ‰                     ‰j                             ¦   «         j        | d         ¦  «         ‰                     | dd…         g d¢¦  «         d S )Nrr  zRES %sr—   rè  éþÿÿÿrú  )	r!  r   rs  ÚreprÚassertInr]  r(  rŽ   r<   ©rX  r.   s    €r/   Ú_cbCheckResultz=OurServerBatchFileTests.testBatchFile.<locals>._cbCheckResultm  sŽ   ø€ Ø—)’)˜EÑ"Ô"ˆCÝŒG�H�t C™yœyÑ(Ñ)Ô)Ð)Ø�MŠM˜$œ,×2Ò2Ñ4Ô4Ô9¸3¸q¼6ÑBÔBÐBØ×ÒØ�A�b�D”	ØVÐVÐVñô ð ð ð r1   ©r^  rÓ   ©r.   rÖ  re  rÕ   s   `   r/   ÚtestBatchFilez%OurServerBatchFileTests.testBatchFilec  sO   ø€ ð
ˆð
	ð 	ð 	ð 	ð 	ð × Ò  Ñ&Ô&ˆØ	�Š�nÑ%Ô%Ð%Øˆr1   c                 ój   ‡ — d}ˆ fd„}‰                       |¦  «        }|                     |¦  «         |S )zO
        Test that an error in the batch file stops running the batch.
        zchown 0 missingFile
pwd
exit
c                 ól   •— ‰                      ‰j                             ¦   «         j        | ¦  «         d S r(   )ÚassertNotInr]  r(  rŽ   rd  s    €r/   re  z9OurServerBatchFileTests.testError.<locals>._cbCheckResultƒ  s0   ø€ Ø×Ò˜Tœ\×5Ò5Ñ7Ô7Ô<¸cÑBÔBÐBÐBÐBr1   rf  rg  s   `   r/   Ú	testErrorz!OurServerBatchFileTests.testErrorz  sT   ø€ ðˆð
	Cð 	Cð 	Cð 	Cð 	Cð × Ò  Ñ&Ô&ˆØ	�Š�nÑ%Ô%Ð%Øˆr1   c                 ój   ‡ — d}ˆ fd„}‰                       |¦  «        }|                     |¦  «         |S )z_
        Test that a minus sign '-' at the front of a line ignores
        any errors.
        z-chown 0 missingFile
pwd
exit
c                 ól   •— ‰                      ‰j                             ¦   «         j        | ¦  «         d S r(   )rc  r]  r(  rŽ   rd  s    €r/   re  z@OurServerBatchFileTests.testIgnoredError.<locals>._cbCheckResult”  s.   ø€ Ø�MŠM˜$œ,×2Ò2Ñ4Ô4Ô9¸3Ñ?Ô?Ð?Ð?Ð?r1   rf  rg  s   `   r/   ÚtestIgnoredErrorz(OurServerBatchFileTests.testIgnoredErrorŠ  sT   ø€ ð
ˆð
	@ð 	@ð 	@ð 	@ð 	@ð × Ò  Ñ&Ô&ˆØ	�Š�nÑ%Ô%Ð%Øˆr1   N)
rA   rB   rC   rD   r0   rÁ  r^  rh  rl  ro  rE   r1   r/   rR  rR  4  sy   € € € € € ðð ð
ð ð ð!ð !ð !ðð ð ð@ð ð ð.ð ð ð ð ð ð ð r1   rR  Ússhz$no ssh command-line client availableÚsftpz%no sftp command-line client availablec                   ó$   — e Zd ZdZd„ Zd„ Zd„ ZdS )ÚOurServerSftpClientTestsz@
    Test the sftp server against sftp command line client.
    c                 ó^   — t                                | ¦  «         |                      ¦   «         S r(   rT  r-   s    r/   r0   zOurServerSftpClientTests.setUp¤  s(   € Ý× Ò  Ñ&Ô&Ð&Ø×ÒÑ!Ô!Ð!r1   c                 ó*   — |                       ¦   «         S r(   )r¹  r-   s    r/   rÁ  z!OurServerSftpClientTests.tearDown¨  s   € Ø�ŠÑ Ô Ð r1   c                 óT  ‡ ‡‡‡‡	— t          t          j        ¦  «        Š‰                      ¦   «         Št	          ‰d¦  «        5 }|                     d¦  «         ddd¦  «         n# 1 swxY w Y   ‰ j                             ¦   «         j        Š	t          j
        Šˆfd„}‰                      t          d|¦  «         d‰ j        j        _        t          dd‰¦  «        }ˆˆ	fd	„}ˆ fd
„}|                     |¦  «         |                     ˆfd„¦  «         |                     |¦  «        S )a  
        Test the return of extended attributes by the server: the sftp client
        should ignore them, but still be able to parse the response correctly.

        This test is mainly here to check that
        L{filetransfer.FILEXFER_ATTR_EXTENDED} has the correct value.
        r,  z	ls .
exitNc                 ó*   •—  ‰| |¦  «        }d|d<   |S )NrË   Úext_foorE   )r.   Úsr¡   Ú
oldGetAttrs      €r/   Ú	_getAttrszCOurServerSftpClientTests.test_extendedAttributes.<locals>._getAttrs¾  s#   ø€ Ø�J˜t QÑ'Ô'ˆEØ$ˆE�)ÑØˆLr1   r{  Trp  )ú-oúPubkeyAcceptedKeyTypes=ssh-dssz-Vc                 óJ   •— | dk    rd}nd}|dddddddd	dd
‰fz  d‰dfz  }|S )Nr   )r|  r}  rE   z-Fz	/dev/nullr|  zIdentityFile=dsa_testzUserKnownHostsFile=kh_testzHostKeyAlgorithms=ssh-rsazPort=%iz-bztestuser@127.0.0.1rE   )ÚstatusÚargsrY  rÑ  s     €€r/   ÚhasPAKTzAOurServerSftpClientTests.test_extendedAttributes.<locals>.hasPAKTÌ  s^   ø€ Ø˜Š{ˆ{Ø?��à�ð ØØØØ'ØØ,ØØ+ØØ˜T˜GÑ#ØØØ$ðñ ˆDð ˆKr1   c                 ó¶   •— ‰                      | d         d| d                              d¦  «        ¦  «         dD ]}‰                     || d         ¦  «         Œd S )Nr  r   r—   Úasciirú  )r<   r   rc  )r   Úir.   s     €r/   r<  z?OurServerSftpClientTests.test_extendedAttributes.<locals>.checkå  si   ø€ Ø×Ò˜V AœY¨¨6°!¬9×+;Ò+;¸GÑ+DÔ+DÑEÔEÐEðð ,ð ,�ð —’˜a ¨¤Ñ+Ô+Ð+Ð+ð,ð ,r1   c                 ó&   •— t          d| ‰¦  «        S )Nrq  )r   )r€  rÏ  s    €r/   r`  zBOurServerSftpClientTests.test_extendedAttributes.<locals>.<lambda>ð  s   ø€ Õ#;¸FÀDÈ#Ñ#NÔ#N€ r1   )ÚdictrP   rQ   r  r  r©   r¬  rÐ  rÑ  r#   r{  rT   r´  r¶  r   rÓ   )
r.   r¤  r{  rÕ   r�  r<  rÏ  rY  rz  rÑ  s
   `     @@@@r/   Útest_extendedAttributesz0OurServerSftpClientTests.test_extendedAttributes«  s‚  øøøøø€ õ •2”:ÑÔˆà�[Š[‰]Œ]ˆÝ�"�c‰]Œ]ð 	"˜aØ�GŠG�LÑ!Ô!Ð!ð	"ð 	"ð 	"ñ 	"ô 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"øøøð 	"ð 	"ð 	"ð 	"àŒ{×"Ò"Ñ$Ô$Ô)ˆå.Ô8ˆ
ð	ð 	ð 	ð 	ð 	ð
 	�
Š
Õ,¨k¸9ÑEÔEÐEØ59ˆŒÔÔ2õ ˜EÐ#QÐSVÑWÔWˆð	ð 	ð 	ð 	ð 	ð 	ð2	,ð 	,ð 	,ð 	,ð 	,ð 	
�Š�gÑÔÐØ	�ŠÐNÐNÐNÐNÑOÔOÐOØ�}Š}˜UÑ#Ô#Ð#s   ÁA%Á%A)Á,A)N)rA   rB   rC   rD   r0   rÁ  r‡  rE   r1   r/   rs  rs  œ  sP   € € € € € ðð ð"ð "ð "ð!ð !ð !ðF$ð F$ð F$ð F$ð F$r1   rs  )RrD   rÍ   rs   rV   rP   rå   rÐ   rM   Úior   r   Úunittestr   Úzope.interfacer   Útwisted.conchr   Útwisted.conch.interfacesr   Ú$twisted.conch.test.test_filetransferr	   r
   Útwisted.credr   Útwisted.internetr   r   r   r   r   Útwisted.internet.taskr   Útwisted.internet.testingr   Útwisted.internet.utilsr   r   Útwisted.pythonr   Útwisted.python.fakepwdr   Útwisted.python.filepathr   Útwisted.python.procutilsr   Útwisted.python.reflectr   Útwisted.trial.unittestr   r   ÚunixÚtwisted.conch.scriptsr   Útwisted.conch.scripts.cftpr   Útwisted.conch.sshr   Útwisted.conch.ssh.connectionr   Útwisted.conch.testr    r!   Útwisted.conch.test.test_conchr"   r#   ÚImportErrorÚ	skipTestsÚIReactorProcessr%   rG   r€   r‰   r•   r¤   r¼   r[  ÚProcessProtocolrf  rš  rÃ  rR  rs  rE   r1   r/   ú<module>r¤     sú  ðð
ð ð €€€Ø €€€Ø €€€Ø 	€	€	€	Ø €€€Ø 
€
€
€
Ø €€€Ø %Ð %Ð %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ð Ð à &Ð &Ð &Ð &Ð &Ð &à Ð Ð Ð Ð Ð Ø .Ð .Ð .Ð .Ð .Ð .Ø UÐ UÐ UÐ UÐ UÐ UÐ UÐ UØ Ð Ð Ð Ð Ð Ø HÐ HÐ HÐ HÐ HÐ HÐ HÐ HÐ HÐ HÐ HÐ HÐ HÐ HØ 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø LÐ LÐ LÐ LÐ LÐ LÐ LÐ LØ Ð Ð Ð Ð Ð Ø /Ð /Ð /Ð /Ð /Ð /Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø *Ð *Ð *Ð *Ð *Ð *Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø +Ð +Ð +Ð +Ð +Ð +àˆ}˜^Ñ,Ô,€Ø€}Ð)Ñ*Ô*€àð 
ð	Ø.Ð.Ð.Ð.Ð.Ð.Ø9Ð9Ð9Ð9Ð9Ð9Ø2Ð2Ð2Ð2Ð2Ð2ØEÐEÐEÐEÐEÐEØ;Ð;Ð;Ð;Ð;Ð;Ð;Ð;Ø;Ð;Ð;Ð;Ð;Ð;ØRÐRÐRÐRÐRÐRÐRøØð ð ð Øˆðøøøð €	ØˆD�,Ð : 
Ô :¸7ÀDÑ IÔ IÐJÐJÐJØ€Ið €ˆ	Ð?Ñ@Ô@ð$
ð $
ð $
ð $
ð $
�hñ $
ô $
ñ AÔ@ð$
ðN_
ð _
ð _
ð _
ð _
�8ñ _
ô _
ð _
ðDð ð ð ð ˜ñ ô ð ð #.ð #.ð #.ð #.ð #.ñ #.ô #.ð #.ðL9ð 9ð 9ð 9ð 9ñ 9ô 9ð 9ð6 €ˆYÑÔð/&ð /&ð /&ð /&ð /&˜ñ /&ô /&ñ Ôð/&ðd €ˆ	Ð?Ñ@Ô@ðp
ð p
ð p
ð p
ð p
�xñ p
ô p
ñ AÔ@ðp
ðf.ð .ð .ð .ð .ñ .ô .ð .ðxð xð xð xð x�hÔ.ñ xô xð xðv$+ð $+ð $+ð $+ð $+˜ñ $+ô $+ð $+ðN €ˆ	Ð?Ñ@Ô@ðKð Kð Kð Kð KÐ"4ñ Kô Kñ AÔ@ðKð\ €ˆ	Ð?Ñ@Ô@ðdð dð dð dð dÐ0ñ dô dñ AÔ@ðdðN €ˆ	Ð?Ñ@Ô@Ø€ˆEˆE�%‰LŒLÐÐ@ÑAÔAØ€ˆEˆE�&‰MŒMÐÐBÑCÔCðR$ð R$ð R$ð R$ð R$Ð1ñ R$ô R$ñ DÔCñ BÔAñ AÔ@ðR$ð R$ð R$s   Â,,C ÃC!Ã C!