ó
‹wÛjc           @   sè  d  d l  m Z e j d ƒ Z d  d l m Z d  d l Z d  d l Z	 d  d l
 Z
 d  d l Z d  d l m Z m Z m Z d  d l Z y d  d l Z Wn e k
 r° d Z n Xd a d e j f d „  ƒ  YZ e rû d e
 j f d	 „  ƒ  YZ e j Z n d d d
 „  ƒ  YZ d Z d e
 j f d „  ƒ  YZ d e j f d „  ƒ  YZ d e f d „  ƒ  YZ e j e d ƒ d e f d „  ƒ  Yƒ Z d e j f d „  ƒ  YZ e j e d ƒ d e f d „  ƒ  Yƒ Z  d „  Z! e" d k räe! ƒ  n  d S(   iÿÿÿÿ(   t   test_supportt	   threading(   t   contextmanagerN(   t   reap_threadst   verboset   transient_internett   TestImaplibc           B   s   e  Z d  „  Z RS(   c         C   s=   d d t  j d ƒ d g } x | D] } t j | ƒ q" Wd  S(   Ni ”5wg    eÍÝAs   "18-May-2033 05:33:20 +0200"(   t   timet	   localtimet   imaplibt   Time2Internaldate(   t   selft
   timevaluest   t(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyt,   test_that_Time2Internaldate_returns_a_result   s    	(   t   __name__t
   __module__R   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyR      s   t   SecureTCPServerc           B   s   e  Z d  „  Z RS(   c         C   s:   |  j  j ƒ  \ } } t j | d t d t ƒ} | | f S(   Nt   server_sidet   certfile(   t   sockett   acceptt   sslt   wrap_sockett   Truet   CERTFILE(   R   t	   newsockett   fromaddrt
   connstream(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyt   get_request)   s
    	(   R   R   R   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyR   '   s   c           B   s   e  Z RS(    (   R   R   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyR   4   s   t   SimpleIMAPHandlerc           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   i   c         C   s,   t  r d G| j ƒ  GHn  |  j j | ƒ d  S(   Ns   SENT:(   R   t   stript   wfilet   write(   R   t   message(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyt   _send>   s     c         C   s  |  j  d ƒ xø d } x\ y0 |  j j d ƒ } | d k r> d  S| | 7} Wn t k
 r] d  SX| j d ƒ r Pq q Wt r� d G| j ƒ  GHn  | j ƒ  } | d } | d } | d } t |  d | f ƒ rí t	 |  d | f ƒ | | ƒ q |  j  d	 | | f ƒ q Wd  S(
   Ns   * OK IMAP4rev1
t    i   s   
s   GOT:i    i   s   cmd_%ss   %s BAD %s unknown
(
   R#   t   rfilet   readt   IOErrort   endswithR   R   t   splitt   hasattrt   getattr(   R   t   linet   partt	   splitlinet   tagt   cmdt   args(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyt   handleB   s,     


 c         C   s%   |  j  d ƒ |  j  d | f ƒ d  S(   Ns   * CAPABILITY IMAP4rev1
s   %s OK CAPABILITY completed
(   R#   (   R   R/   R1   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyt   cmd_CAPABILITYb   s    (   R   R   t   timeoutR#   R2   R3   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyR   :   s   		 t   BaseThreadedNetworkedTestsc           B   sP   e  Z d  „  Z d „  Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z d „  Z	 RS(   c      	   C   sÛ   d |  j  f d „  ƒ  Y} t r' d GHn  | | | ƒ } |  j | j | j j ƒ  ƒ t r� d GHd G| GHd G|  j  GHd G| j GHn  t j d d	 |  j  d
 | j	 d i d d 6ƒ } t
 | _ | j ƒ  t rÑ d GHn  | | f S(   Nt   MyServerc           B   s   e  Z d  „  Z RS(   c         S   s   |  j  | ƒ |  j ƒ  ‚  d  S(   N(   t   close_requestt   server_close(   R   t   requestt   client_address(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyt   handle_errorl   s    
(   R   R   R;   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyR6   k   s   s   creating servers   server createds   ADDR =s   CLASS =s   HDLR =t   names
   %s servingt   targett   kwargsg{®Gáz„?t   poll_intervals   server running(   t   server_classR   t   assertEqualt   server_addressR   t   getsocknamet   RequestHandlerClassR   t   Threadt   serve_foreverR   t   daemont   start(   R   t   addrt   hdlrR6   t   serverR   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyt   make_serveri   s&     				
 c         C   s4   t  r d GHn  | j ƒ  | j ƒ  t  r0 d GHn  d  S(   Ns   waiting for servert   done(   R   t   shutdownt   join(   R   RK   t   thread(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyt   reap_server‡   s     

 c         c   sB   |  j  t j d f | ƒ \ } } z	 | VWd  |  j | | ƒ Xd  S(   Ni    (   RL   t   supportt   HOSTRQ   (   R   RJ   RK   RP   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyt   reaped_server�   s    !	c         C   s8   |  j  t ƒ �# } |  j | j Œ  } | j ƒ  Wd  QXd  S(   N(   RT   R   t
   imap_classRB   RN   (   R   RK   t   client(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyt   test_connect•   s    c         C   sT   d t  j f d „  ƒ  Y} |  j | ƒ �& } |  j t j j |  j | j Œ Wd  QXd  S(   Nt
   EOFHandlerc           B   s   e  Z d  „  Z RS(   c         S   s   |  j  j d ƒ d  S(   Ns   * OK(   R    R!   (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyR2   Ÿ   s    (   R   R   R2   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyRX   ž   s   (	   t   SocketServert   StreamRequestHandlerRT   t   assertRaisesR	   t   IMAP4t   abortRU   RB   (   R   RX   RK   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyt   test_issue5949›   s    c            s‰   d ‰  d t  f ‡  f d †  ƒ  Y} |  j | ƒ �R } t j t d ˆ  ƒ �4 |  j t j j d ƒ � |  j | j	 Œ  Wd  QXWd  QXWd  QXd  S(   Ni
   t   TooLongHandlerc              s   e  Z ‡  f d  †  Z RS(   c            s    |  j  j d ˆ  d d ƒ d  S(   Ns   * OK t   xs   
(   R    R!   (   R   (   t   maxline(    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyR2   ¬   s    (   R   R   R2   (    (   Ra   (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyR_   «   s   t   _MAXLINEs   got more than 10 bytes(
   R   RT   RR   t	   swap_attrR	   t   assertRaisesRegexpR\   t   errorRU   RB   (   R   R_   RK   (    (   Ra   s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyt   test_linetoolong¨   s    
(
   R   R   RL   RQ   R   RT   R   RW   R^   Rf   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyR5   g   s   		t   ThreadedNetworkedTestsc           B   s   e  Z e j Z e j Z RS(    (   R   R   RY   t	   TCPServerR@   R	   R\   RU   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyRg   ¶   s   	s   SSL not availablet   ThreadedNetworkedTestsSSLc           B   s   e  Z e Z e Z RS(    (   R   R   R   R@   t	   IMAP4_SSLRU   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyRi   ¼   s   t   RemoteIMAPTestc           B   sV   e  Z d  Z d Z d Z d Z e j Z d „  Z	 d „  Z
 d „  Z d „  Z d „  Z RS(	   s   cyrus.andrew.cmu.edui�   t	   anonymoust   passc         C   s5   t  |  j ƒ �  |  j |  j |  j ƒ |  _ Wd  QXd  S(   N(   R   t   hostRU   t   portRK   (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyt   setUpÊ   s    c         C   s#   |  j  d  k	 r |  j  j ƒ  n  d  S(   N(   RK   t   Nonet   logout(   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyt   tearDownÎ   s    c         C   s   |  j  d |  j j k ƒ d  S(   Nt   LOGINDISABLED(   t
   assertTrueRK   t   capabilities(   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyt   test_logincapaÒ   s    c         C   sL   |  j  d |  j j k ƒ |  j j |  j |  j ƒ } |  j | d d ƒ d  S(   Ns   AUTH=ANONYMOUSi    t   OK(   Ru   RK   Rv   t   logint   usernamet   passwordRA   (   R   t   rs(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyt   test_anonloginÕ   s    c         C   s0   |  j  j ƒ  } d  |  _  |  j | d d ƒ d  S(   Ni    t   BYE(   RK   Rr   Rq   RA   (   R   R|   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyt   test_logoutÚ   s    	(   R   R   Rn   Ro   Rz   R{   R	   R\   RU   Rp   Rs   Rw   R}   R   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyRk   Ã   s   					t   RemoteIMAP_SSLTestc           B   s   e  Z d  Z e Z d „  Z RS(   iá  c         C   s6   |  j  d |  j j k ƒ |  j d |  j j k ƒ d  S(   NRt   s
   AUTH=PLAIN(   t   assertFalseRK   Rv   Ru   (   R   (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyRw   å   s    (   R   R   Ro   Rj   RU   Rw   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyR€   à   s   c          C   sœ   t  g }  t j d ƒ r‹ t ro t j j t j j t ƒ p? t j	 d ƒ a
 t j j t
 ƒ so t j d ƒ ‚ qo n  |  j t t t t g ƒ n  t j |  Œ  d  S(   Nt   networks   keycert.pems   Can't read certificate files!(   R   RR   t   is_resource_enabledR   t   ost   pathRO   t   dirnamet   __file__t   curdirR   t   existst
   TestFailedt   extendRg   Ri   Rk   R€   t   run_unittest(   t   tests(    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyt	   test_mainê   s    	!	t   __main__(    (#   t   testR    RR   t   import_moduleR   t
   contextlibR   R	   t   os.pathR„   RY   R   R   R   R   t   unittestR   t   ImportErrorRq   R   t   TestCaseR   Rh   R   Rj   RZ   R   R5   Rg   t
   skipUnlessRi   Rk   R€   RŽ   R   (    (    (    s‡   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_imaplib.pyt   <module>   s<   
	-O		