ó
[³XMc           @   sS   d  Z  d d l m Z d d l m Z d d l m Z d e j f d „  ƒ  YZ d S(   s(   
Tests for L{twisted.protocols.finger}.
iÿÿÿÿ(   t   unittest(   t   finger(   t   StringTransportt   FingerTestCasec           B   s;   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s%   
    Tests for L{finger.Finger}.
    c         C   s2   t  ƒ  |  _ t j ƒ  |  _ |  j j |  j ƒ d S(   sA   
        Create and connect a L{finger.Finger} instance.
        N(   R   t	   transportR   t   Fingert   protocolt   makeConnection(   t   self(    (    s<   /usr/lib/python2.7/dist-packages/twisted/test/test_finger.pyt   setUp   s    c         C   s-   |  j  j d ƒ |  j |  j j ƒ  d ƒ d S(   sž   
        When L{finger.Finger} receives a CR LF terminated line, it responds
        with the default user status message - that no such user exists.
        s   moshez
s   Login: moshez
No such user
N(   R   t   dataReceivedt   assertEqualR   t   value(   R   (    (    s<   /usr/lib/python2.7/dist-packages/twisted/test/test_finger.pyt   test_simple   s    c         C   s-   |  j  j d ƒ |  j |  j j ƒ  d ƒ d S(   s§   
        The behavior for a query which begins with C{"/w"} is the same as the
        behavior for one which does not.  The user is reported as not existing.
        s   /w moshez
s   Login: moshez
No such user
N(   R   R
   R   R   R   (   R   (    (    s<   /usr/lib/python2.7/dist-packages/twisted/test/test_finger.pyt   test_simpleW%   s    c         C   s-   |  j  j d ƒ |  j |  j j ƒ  d ƒ d S(   s‡   
        When L{finger.Finger} receives a request for a remote user, it responds
        with a message rejecting the request.
        s   moshez@example.com
s!   Finger forwarding service denied
N(   R   R
   R   R   R   (   R   (    (    s<   /usr/lib/python2.7/dist-packages/twisted/test/test_finger.pyt   test_forwarding0   s    c         C   s-   |  j  j d ƒ |  j |  j j ƒ  d ƒ d S(   s   
        When L{finger.Finger} receives a blank line, it responds with a message
        rejecting the request for all online users.
        s   
s   Finger online list denied
N(   R   R
   R   R   R   (   R   (    (    s<   /usr/lib/python2.7/dist-packages/twisted/test/test_finger.pyt	   test_list;   s    (   t   __name__t
   __module__t   __doc__R	   R   R   R   R   (    (    (    s<   /usr/lib/python2.7/dist-packages/twisted/test/test_finger.pyR      s   					N(	   R   t   twisted.trialR    t   twisted.protocolsR   t   twisted.test.proto_helpersR   t   TestCaseR   (    (    (    s<   /usr/lib/python2.7/dist-packages/twisted/test/test_finger.pyt   <module>   s   