
    ,hZ                     |   d dl mZ d dlZd dlZd dlZd dlmZ d dlZd dlmZm	Z	m
Z
 d dlmZ ddlmZ ddlmZ  G d	 d
e      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d d e      Zy)!    )unicode_literalsN)datetime)patchsentinelMock)FixedOffset   )TestableIMAPClient)IMAPClientTestc                   f    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 Zd Zy)TestListFoldersc                 n   ddgf| j                   j                  j                  _        dt        j
                  f| j                   j                  j                  _        t        t        j                        | j                   _	        | j                   j                  dd      }| j                   j                  j                  j                  ddd       | j                  | j                   j                  j                  t        j
                  fi f       | j                  |t        j                  u        y )	NOK	   somethingLISTreturn_valuefoobar   "foo"   "bar")client_imap_simple_commandr   r   folder_data_untagged_responser   folder_list_proc_folder_listlist_foldersassert_called_once_withassertEqual	call_args
assertTrueselffolderss     a/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/imapclient/test/test_imapclient.pytest_list_foldersz!TestListFolders.test_list_folders   s    :>9O))6=CXEYEY<Z,,9(,(:N:N(O%++**5%8))AAHh	(66@@HDXDXCZ\^B_`8#7#778    c                 n   ddgf| j                   j                  j                  _        dt        j
                  f| j                   j                  j                  _        t        t        j                        | j                   _	        | j                   j                  dd      }| j                   j                  j                  j                  ddd       | j                  | j                   j                  j                  t        j
                  fi f       | j                  |t        j                  u        y )	Nr   r   LSUBr   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   list_sub_foldersr    r!   r"   r#   r$   s     r'   test_list_sub_foldersz%TestListFolders.test_list_sub_folders"   s    :>9O))6=CXEYEY<Z,,9(,(:N:N(O%++..ue<))AAHh	(66@@HDXDXCZ\^B_`8#7#778r)   c                     ddgf| j                   j                  j                  _        | j	                  t
        j                  | j                   j                         y NNOs   badnessr   r   r   r   assertRaises
IMAPClientErrorr   r%   s    r'   test_list_folders_NOz$TestListFolders.test_list_folders_NO.   A    :>9M))6***DKK,D,DEr)   c                     ddgf| j                   j                  j                  _        | j	                  t
        j                  | j                   j                         y r/   r1   r5   s    r'   test_list_sub_folders_NOz(TestListFolders.test_list_sub_folders_NO2   r7   r)   c                 h   ddgf| j                   j                  j                  _        dddgf| j                   j                  j                  _        | j                   j                  dd      }| j                   j                  j                  j                  ddd	       | j                  |d
dg       y )Nr   r   r      (\HasNoChildren) "/" "A"&   (\HasNoChildren) "/" "Hello&AP8-world"r   r   r   r      \HasNoChildren   /A)r>   r@   u   Helloÿworld)r   r   r   r   r   r   r    r!   r$   s     r'   test_utf7_decodingz"TestListFolders.test_utf7_decoding6   s    :>9O))6,:=,,9 ++**5%8))AA&(T\]#E#R#T 	Ur)   c                    d| j                   _        ddgf| j                   j                  j                  _        dddgf| j                   j                  j
                  _        | j                   j                  dd      }| j                   j                  j                  j                  dd	d
       | j                  |ddg       y )NFr   r   r   r;   r<   r   r   z"foo"z"bar")r>   r@      A)r>   r@   s   Hello&AP8-world)	r   folder_encoder   r   r   r   r   r    r!   r$   s     r'   test_folder_encode_offz&TestListFolders.test_folder_encode_offD   s    $)!:>9O))6,:=,,9 ++**5%8))AA&'SZ[#F#T#V 	Wr)   c                 f    | j                   j                  ddg      }| j                  |ddg       y )Nr;      (\HasNoChildren) "/" "Foo Bar"r=   r>   r@   zFoo Barr   r   r!   r$   s     r'   test_simplezTestListFolders.test_simpleS   s@    ++//1M1S13 4 	#F#K#M 	Nr)   c                 f    | j                   j                  g d      }| j                  |g d       y )N)s   (\HasNoChildren) "/" As   (\HasNoChildren) "/" B   (\HasNoChildren) "/" C)r=   )r>   r@   Br>   r@   CrJ   r$   s     r'   test_without_quotesz#TestListFolders.test_without_quotesZ   4    ++// 13 4 	 #G 	Hr)   c                 b    | j                   j                  dg      }| j                  |dg       y )Ns   (\HasNoChildren) "/" 123)r>   r@   123rJ   r$   s     r'   !test_unquoted_numeric_folder_namez1TestListFolders.test_unquoted_numeric_folder_namec   s.    ++//1M0NO#G"HIr)   c                     t        t        j                  dz         }| j                  j	                  d|j                  d      z   g      }| j                  |dd|fg       y )Nr	   s   (\HasNoChildren) "/" asciir>   r@   )strsysmaxsizer   r   encoder!   )r%   folder_namer&   s      r'   0test_unqouted_numeric_folder_name_parsed_as_longz@TestListFolders.test_unqouted_numeric_folder_name_parsed_as_longh   sZ    #++/*++//&););G)DDEG$:D+#N"OPr)   c                 f    | j                   j                  g d      }| j                  |g d       y )N)s   (\HasNoChildren) "/" AlpharH   rM   ))r>   r@   AlpharI   rO   rJ   r$   s     r'   
test_mixedzTestListFolders.test_mixedo   rR   r)   c                 f    | j                   j                  g d      }| j                  |ddg       y )N))s    (\NoInferiors \UnMarked) "/" {5}   bangÿr)   s&   (\HasNoChildren \UnMarked) "/" "INBOX"))s   \NoInferiors	   \UnMarkedr@   rb   ))r?   rc   r@   INBOXrJ   r$   s     r'   test_funky_charactersz%TestListFolders.test_funky_charactersx   s<    ++// 1^ _ 	#X#W#Y 	Zr)   c                 f    | j                   j                  g d      }| j                  |g d       y )N)s&   (\HasNoChildren) "/" "Test \"Folder\""s"   (\HasNoChildren) "/" "Left\"Right"s"   (\HasNoChildren) "/" "Left\\Right"s%   (\HasNoChildren) "/" "\"Left Right\""s&   (\HasNoChildren) "/" "\"Left\\Right\""))r>   r@   zTest "Folder")r>   r@   z
Left"Right)r>   r@   z
Left\Right)r>   r@   z"Left Right")r>   r@   z"Left\Right"rJ   r$   s     r'   test_quoted_specialsz$TestListFolders.test_quoted_specials   s2    ++// 13 4 	 #% 	&r)   c                 \    | j                  | j                  j                  d g      g        y N)r!   r   r   r5   s    r'   test_empty_responsez#TestListFolders.test_empty_response   s#    66v>Cr)   c                 d    | j                   j                  g d      }| j                  |dg       y )N) Ns   (\HasNoChildren) "/" "last")r>   r@   lastrJ   r$   s     r'   test_blankszTestListFolders.test_blanks   s+    ++//0[\#H"IJr)   N)__name__
__module____qualname__r(   r-   r6   r9   rB   rF   rK   rQ   rU   r]   r`   re   rg   rj   rn    r)   r'   r   r      sY    
9
9FFUWNHJ
QHZ&DKr)   r   c                       e Zd Zd Zy)TestSelectFolderc                    t               | j                  _        dgdgdgg ddgdgdgdgd	gd
gd
| j                  j                  _        | j                  j                  dt        j                        }| j                  j                  j                  ddt        j                         d| _	        | j                  |ddddddddd
gd	       y )N   3s%   (\Flagged \Deleted abc [foo]/bar def)s   127110)sJ   [PERMANENTFLAGS (\Flagged \Deleted abc [foo]/bar def \*)] Flags permitted.s#   [UIDVALIDITY 631062293] UIDs valid.s"   [UIDNEXT 1281] Predicted next UID.s   [HIGHESTMODSEQ 127110]s   (\Flagged \Deleted abc [foor)      0s   1281s	   631062293   blah)
s   exists   FLAGS   HIGHESTMODSEQ   OK   PERMANENTFLAGS
   READ-WRITE   RECENT   UIDNEXT   UIDVALIDITY   OTHERs   folder_nameselects   "folder_name"i    r   i  i?%i )   \Flagged   \Deleted   abc	   [foo]/bar   def)r   r   r   r   r   s   \*T)	   EXISTSr~   r   r   rz   ry   r|   r}   r   )r   r   _command_and_checkr   untagged_responsesselect_folderr   readonlyr    maxDiffr!   )r%   results     r'   test_normalzTestSelectFolder.test_normal   s    )-&v@A(k/ !@@5v 	)Ni0
,  **>8;L;LM&&>>x?O?G?P?P	R %$Pai
"
 
	r)   N)ro   rp   rq   r   rr   r)   r'   rt   rt      s    "r)   rt   c                   .    e Zd Zd Z ed      d        Zy)
TestAppendc                     ddgf| j                   j                  j                  _        d}| j                   j                  d|ddgd        | j                   j                  j                  j	                  ddd d	       y )
Nr      GoodhifoobarFLAGWAVE   "foobar"(FLAG WAVE)s   hi)r   r   appendr   assert_called_with)r%   msgs     r'   test_without_msg_timez TestAppend.test_without_msg_time   sj    15y0A  -8S66*:DA  33e	5r)   z.imapclient.imapclient.datetime_to_INTERNALDATEc                 r   d|_         ddgf| j                  j                  j                  _         d}| j                  j                  d|ddgt	        dd	d
ddd
dt        d                   | j                  |j                         | j                  j                  j                  j                  ddd|       y )Nsomedater   r   s   byer   r   r   i           r   x   r   r   z
"somedate")	r   r   r   r   r   r   r#   calledr   )r%   datetime_to_INTERNALDATEr   s      r'   test_with_msg_timezTestAppend.test_with_msg_time   s    0: -15y0A  -8S66*:#D!QAq![=PQ	S 	0778  33c	;r)   N)ro   rp   rq   r   r   r   rr   r)   r'   r   r      s!    5 ;<
; =
;r)   r   c                       e Zd Zd Zd Zy)TestAclMethodsc                     ddgf| j                   j                  j                  _        | j                   j                  d      }| j	                  |ddg       y )Nr   s   INBOX Fred rwipslda Sally rwiprd   )s   Freds   rwipslda)s   Sallys   rwip)r   r   getaclr   assertSequenceEqual)r%   acls     r'   test_getaclzTestAclMethods.test_getacl   sN    158Y7Z0[  -kk  )  '=?R&STr)   c                    ddgf| j                   j                  j                  _        | j                   j                  dt        j
                  t        j                        }| j                   j                  j                  j                  dt        j
                  t        j                         | j                  |d       y )Nr   s   SETACL donefolders   "folder")	r   r   setaclr   r   whowhatr   r!   )r%   responses     r'   test_setaclzTestAclMethods.test_setacl   s    157G0H  -;;%%hhmmL  33K4<LL4<MM	C 	>2r)   N)ro   rp   rq   r   r   rr   r)   r'   r   r      s    U
3r)   r   c                   ~    e Zd Zd Zd Z ed      d        Z ed      d        Z ed      d        Zd Z	d Z
d	 Zy
)TestIdleAndNoopc                 T    | j                  |j                  ddi fddi fddi fg       y )N
settimeoutri   setblocking)r   )r	   )assertListEqualmethod_calls)r%   socks     r'   assert_sock_callsz!TestIdleAndNoop.assert_sock_calls   s;    T..7B'D"%D"%1
 	r)   c                    t         j                  | j                  j                  j                  _        d | j                  j                  j                  _        | j                  j                          | j                  j                  j                  j                  d       | j                  | j                  j                  t         j                         y )NIDLE)r   tagr   r   _commandr   _get_responseidler   r!   	_idle_tagr5   s    r'   	test_idlezTestIdleAndNoop.test_idle   s    2:,,""/7;''4""55f=..=r)   z#imapclient.imapclient.select.selectc                    t               }|x| j                  j                  _        | j                  j                  _        dgg g f|_        t        j                         fd}|| j                  j                  _        | j                  j                         }|j                  |gg g d        | j                  |       | j                  ddg|       y )NTc                  f    t        j                        } | dk(  ry| dk(  ryt        j                  )Nr   s
   * 1 EXISTSr	   s   * 0 EXPUNGEsixnextsockettimeoutcountcounters    r'   fake_get_linez?TestIdleAndNoop.test_idle_check_blocking.<locals>.fake_get_line   s/    HHW%Ez$!%nn$r)   )r	   r   )r   s   EXPUNGEr   r   r   r   sslobjr   	itertoolsr   	_get_line
idle_checkr    r   r   r%   mock_select	mock_sockr   	responsesr   s        @r'   test_idle_check_blockingz(TestIdleAndNoop.test_idle_check_blocking   s    F	<EE!2!2!9%)FB#3 //#	% '4#KK**,	++YKRFy)no>	Jr)   c                 @   t               }|x| j                  j                  _        | j                  j                  _        g g g f|_        | j                  j                  d      }|j                  |gg g d       | j                  |       | j                  g |       y )Ng      ?)r   )
r   r   r   r   r   r   r   r    r   r   )r%   r   r   r   s       r'   test_idle_check_timeoutz'TestIdleAndNoop.test_idle_check_timeout  s    F	<EE!2!2!9$&B< KK**3*7	++YKREy)R+r)   c                    t               }|x| j                  j                  _        | j                  j                  _        dgg g f|_        t        j                         fd}|| j                  j                  _        | j                  j                         }|j                  |gg g d        | j                  |       | j                  dg|       y )NTc                  Z    t        j                        } | dk(  ryt        j                  )Nr      * 99 EXISTSr   r   s    r'   r   z@TestIdleAndNoop.test_idle_check_with_data.<locals>.fake_get_line#  s%    HHW%Ez%nn$r)   c   r   r   r   s        @r'   test_idle_check_with_dataz)TestIdleAndNoop.test_idle_check_with_data  s    F	<EE!2!2!9%)FB#3 //#	% '4#KK**,	++YKRFy)o.	:r)   c                    t         j                  | j                  _        t	               }|| j                  j
                  _        t	        t         j                        }|| j                  _        | j                  j                         }|j                  d       |j                  t         j                  d       | j                  |t         j                         y )Nr   s   DONE
r   )r   r   r   r   r   r   sendout_consume_until_tagged_response	idle_doner   r!   )r%   mockSendmockConsumer   s       r'   test_idle_donezTestIdleAndNoop.test_idle_done1  s     (6!)55@2&&(##K0&&x||V<.r)   c                    t        t        j                        }|| j                  j                  _        t        t        j                        }|| j                  _        | j                  j                         }|j                  d       |j                  t        j                  d       | j                  |t        j                         y )Nr   NOOP)r   r   r   r   r   r   r   r   noopr   r!   )r%   mockCommandr   r   s       r'   	test_noopzTestIdleAndNoop.test_noop?  s    5%0"55@2!!#&&v.&&x||V<.r)   c                    | j                   t        j                  d ij                  _        t        j                         fd}|j                  _        j                  t        j                  d      \  }}| j                  j                  j                  i        | j                  |d       | j                  dg|       y )Nc                      t        j                        } | dk(  ryddgfj                  j                  t        j
                  <   y )Nr   r   r   	   Idle done)r   r   r   tagged_commandsr   r   )r   r   r   s    r'   fake_get_responsezMTestIdleAndNoop.test_consume_until_tagged_response.<locals>.fake_get_responseQ  s:    HHW%Ez%:>9OFLL((6r)   s   IDLEr   r   )r   r   r   r   r   r   r   r   r   r!   r   )r%   r   textr   r   r   s       @@r'   "test_consume_until_tagged_responsez2TestIdleAndNoop.test_consume_until_tagged_responseK  s    (0d';$//#	P
 &7" ??gVi55r:|,o.	:r)   N)ro   rp   rq   r   r   r   r   r   r   r   r   r   rr   r)   r'   r   r      sk    > 01K 2K, 01	, 2	, 01; 2;(/
/;r)   r   c                       e Zd Zd Zd Zy)TestDebugLoggingc                 l    | j                  | j                  j                  t        j                         y ri   )assertIsr   log_filerY   stderrr5   s    r'   test_default_is_stderrz'TestDebugLogging.test_default_is_stderr`  s    dkk**CJJ7r)   c                 6   t        j                         }|| j                  _        | j                  j	                  d       | j                  j
                  j                  d       |j                         }| j                  d|       | j                  d|       y )Nonetwo)	r   StringIOr   r   _logr   _mesggetvalueassertIn)r%   logoutputs      r'   test_IMAP_is_patchedz%TestDebugLogging.test_IMAP_is_patchedc  sj    lln"&eV$eV$r)   N)ro   rp   rq   r   r	  rr   r)   r'   r   r   ^  s    8	%r)   r   c                   .    e Zd Zd Z ed      d        Zy)TestTimeNormalisationc                 N    | j                  | j                  j                         y ri   )r#   r   normalise_timesr5   s    r'   test_defaultz"TestTimeNormalisation.test_defaultq  s    334r)   z*imapclient.imapclient.parse_fetch_responsec                     dt         j                  f j                  j                  j                  _        dt         j                  f j                  j                  j                  _        t         j                   j                  _         fd}d j                  _	         |d       d j                  _	         |d       y )Nr   c                     j                   j                  ddg       j                  t        j                  | t        j
                         y )N   	SOMETHING)r   fetchr   r   
fetch_datause_uid)expectedparse_fetch_responser%   s    r'   checkz6TestTimeNormalisation.test_pass_through.<locals>.checkz  s<    KKb;-0 33H4G4G4<4<4D4DFr)   TF)
r   datar   r   _command_completer   r  r   r  r  )r%   r  r  s   `` r'   test_pass_throughz'TestTimeNormalisation.test_pass_throught  s    <@(--;P++8=A8CVCV<W,,9&..	F '+#d&+#er)   N)ro   rp   rq   r  r   r  rr   r)   r'   r  r  o  s!    5 78 9r)   r  c                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)TestNamespacec                 T    d|gf| j                   j                  j                  _        y )Nr   )r   r   	namespacer   )r%   values     r'   
set_returnzTestNamespace.set_return  s     485'?##0r)   c                 z    | j                  d       | j                  | j                  j                         d       y )Ns   (("FOO." "/")) NIL NIL)))zFOO./NNr!  r!   r   r  r5   s    r'   rK   zTestNamespace.test_simple  s-    12..02PQr)   c                 z    | j                  d       | j                  | j                  j                         d       y )N   (("&AP8-." "/")) NIL NIL)))u   ÿ.r#  NNr$  r5   s    r'   test_folder_decodingz"TestNamespace.test_folder_decoding  s-    34..02QRr)   c                     | j                  d       d| j                  _        | j                  | j                  j	                         d       y )Nr&  F)))s   &AP8-.r#  NN)r!  r   rE   r!   r  r5   s    r'   test_without_folder_decodingz*TestNamespace.test_without_folder_decoding  s9    34$)!..02STr)   c                 z    | j                  d       | j                  | j                  j                         d       y )Ns   NIL NIL (("" ".")))NN))rl   .r$  r5   s    r'   test_other_onlyzTestNamespace.test_other_only  s-    -...02LMr)   c                 z    | j                  d       | j                  | j                  j                         d       y )NsU   (("" "/")) (("~" "/")) (("#shared/" "/") ("#public/" "/")("#ftp/" "/")("#news." ".")))))rl   r#  ))~r#  ))z#shared/r#  )z#public/r#  )z#ftp/r#  )z#news.r+  r$  r5   s    r'   test_complexzTestNamespace.test_complex  s9     Z 	[ 	..0 3
 	r)   N)	ro   rp   rq   r!  rK   r'  r)  r,  r/  rr   r)   r'   r  r    s%    CRSU
Nr)   r  c                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)TestCapabilitiesc                     d| j                   j                  _        i | j                   j                  _        | j	                  | j                   j                         d       y )N)FOOBAR   FOO   BAR)r   r   capabilitiesr   r!   r5   s    r'   test_preauthzTestCapabilities.test_preauth  sD    )7&/1,1135EFr)   c                    d| j                   j                  _        ddgi| j                   j                  _        | j	                  | j                   j
                  d        | j	                  | j                   j                         d       | j	                  | j                   j
                  d       | j	                  | j                   j                  j                  i        y )Nr6  
CAPABILITYs   FOO MOREr6  s   MORE)r   r   r8  r   r!   _cached_capabilitiesr5   s    r'   *test_server_returned_capability_after_authz;TestCapabilities.test_server_returned_capability_after_auth  s    )2&0<{m/L,994@1135FG99;LM**==rBr)   c                     d| j                   j                  _        i | j                   j                  _        d| j                   _        | j                  | j                   j                         d       y )Nr3  r=  )r   r   r8  r   r>  r!   r5   s    r'   test_cachingzTestCapabilities.test_caching  sP    )1&/1,+<(1135FGr)   c                    d| j                   j                  _        i | j                   j                  _        d| j                   j                  _        ddgf| j                   j                  j
                  _        | j                  | j                   j                         d       | j                  | j                   j                  d       y )NrA  SELECTEDr      FOO BARr5  )	r   r   r8  r   state
capabilityr   r!   r>  r5   s    r'   test_post_auth_requestz'TestCapabilities.test_post_auth_request  s    )1&/1,",59J<4H$$11135EF99;KLr)   c                    d| j                   j                  _        i | j                   j                  _        d| j                   j                  _        | j                  | j                   j                         d       d| j                   _        ddgf| j                   j                  j                  _        | j                  | j                   j                         d       d| j                   j                  _        dd	gf| j                   j                  j                  _        | j                  | j                   j                         d
       y )NrA  NONAUTHr;  Tr   rE  r5  AUTHs   FOO BAR QUX)r6  r7  s   QUX)	r   r   r8  r   rF  r!   _starttls_donerG  r   r5   s    r'   test_with_starttlsz#TestCapabilities.test_with_starttls  s    )1&/1,"+113Y? &*"59J<4H$$11135EF #)59N;K4L$$11135MNr)   c                    d| j                   _        | j                  | j                   j                  d             | j                  | j                   j                  d             | j	                  | j                   j                  d             | j                  | j                   j                  d             | j                  | j                   j                  d             | j	                  | j                   j                  d             y )Nr=  r6     foor7  r3  r   r4  )r   r>  r#   has_capabilityassertFalser5   s    r'   test_has_capabilityz$TestCapabilities.test_has_capability  s    +<(226:;226:;33F;<2259:2259:33E:;r)   N)	ro   rp   rq   r9  r?  rB  rH  rM  rR  rr   r)   r'   r1  r1    s%    GCHMO"	<r)   r1  c                       e Zd Zd Zd Zd Zy)TestIdc                    d| j                   _        ddgf| j                   j                  j                  _        ddgf| j                   j                  j
                  _        | j                   j                  ddi      }| j                   j                  j                  j                  dd	       | j                  |d
       y )N)s   IDr   s   Successr{   s(   ("name" "GImap" "vendor" "Google, Inc.")namer3   IDz("name" "IMAPClient")))s   names   GImaps   vendors   Google, Inc.)	r   r>  r   r   r   r   id_r   r   )r%   id_responses     r'   test_idzTestId.test_id  s    +3(:>9M))6?@=B,,9 kkoov|&<=))<<)	+ 	  >	@r)   c                 z    d| j                   _        | j                  t        | j                   j                         y )N)s	   IMAP4rev1)r   r>  r2   
ValueErrorrX  r5   s    r'   test_no_supportzTestId.test_no_support  s&    +:(*dkkoo6r)   c                 Z    | j                  t        | j                  j                  d       y )N
bananarama)r2   	TypeErrorr   rX  r5   s    r'   test_invalid_parameterszTestId.test_invalid_parameters  s    )T[[__lCr)   N)ro   rp   rq   rZ  r]  ra  rr   r)   r'   rT  rT    s    @7Dr)   rT  c                   T     e Zd Z fdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Z xZS )TestRawCommandc                     t         t        |           d | j                  j                  j
                  _        ddgf| j                  j                  j                  _        y Nr   done)superrc  setUpr   r   r   r   r  )r%   	__class__s    r'   rh  zTestRawCommand.setUp   sG    nd)+7;''4<@6(;K++8r)   c                     | j                   j                  ||      \  }}| j                  |d       | j                  |dg       | j                  | j                   j                  j                  |       y re  )r   _raw_commandr!   r   sent)r%   commandargsr  typr  s         r'   r  zTestRawCommand.check  s^    KK,,Wd;	Td#x(**//:r)   c                 ,    | j                  ddgd       y )N   search   ALLs   tag UID SEARCH ALL
r  r5   s    r'   
test_plainzTestRawCommand.test_plain  s    

9vh,	r)   c                 N    d| j                   _        | j                  ddgd       y )NFrq  rr  s   tag SEARCH ALL
)r   r  r  r5   s    r'   test_not_uidzTestRawCommand.test_not_uid  s#    #

9vh(	r)   c                 .    | j                  dddgd       y )Nrq     TEXT   s   tag UID SEARCH TEXT {2}

rs  r5   s    r'   test_literal_at_endz"TestRawCommand.test_literal_at_end  s    

9w4#	r)   c                 .    | j                  dg dd       y )Nrq  )rx  ry  s   DELETEDs%   tag UID SEARCH TEXT {2}
 DELETED
rs  r5   s    r'   test_embedded_literalz$TestRawCommand.test_embedded_literal  s    

9@+	r)   c                 .    | j                  dg dd       y )Nrq  )rx  ry  rx     s)   tag UID SEARCH TEXT {2}
 TEXT {1}

rs  r5   s    r'   test_multiple_literalsz%TestRawCommand.test_multiple_literals"  s    

9F	r)   c                 .    | j                  dg dd       y )Nrq  )s   FLAGGEDrx  ry  rx  r~  rx  rO  s:   tag UID SEARCH FLAGGED TEXT {2}
 TEXT {1}
 TEXT foo
rs  r5   s    r'   r/  zTestRawCommand.test_complex)  s    

9c(	r)   c                     | j                  t        | j                  j                  dg        | j                  t        | j                  j                  ddg       y )Nr   )r2   r\  r   rk  r5   s    r'   test_invalid_input_typez&TestRawCommand.test_invalid_input_type0  s@    *dkk&>&>rJ*dkk&>&>Pr)   c                 B   d| j                   j                  j                  _        ddgf| j                   j                  j                  d<   d}| j                  t        j                  |      5  | j                   j                  ddg       d d d        y # 1 sw Y   y xY w)Nrx   r0   zgo awayr   zXunexpected response while waiting for continuation response: \(u?'NO', \[u?'go away'\]\)r6     )	r   r   r   r   r   assertRaisesRegexr3   
AbortErrorrk  )r%   expected_errors     r'   test_failed_continuation_waitz,TestRawCommand.test_failed_continuation_wait4  s    7>''4489+3F))%0s##J$9$9>J 	8KK$$VgY7	8 	8 	8s   .BB)ro   rp   rq   rh  r  rt  rv  rz  r|  r  r/  r  r  __classcell__)ri  s   @r'   rc  rc    s7    L
;
Q8r)   rc  c                       e Zd Zd Zy)TestShutdownc                     | j                   j                          | j                   j                  j                  j                          y ri   )r   shutdownr   r    r5   s    r'   test_shutdownzTestShutdown.test_shutdown?  s.    ""::<r)   N)ro   rp   rq   r  rr   r)   r'   r  r  =  s    =r)   r  )
__future__r   r   r   rY   r   r   mockr   r   r   imapclient.fixed_offsetr   testable_imapclientr
   r3   imapclient_testr   r   rt   r   r   r   r   r  r  r1  rT  rc  r  rr   r)   r'   <module>r     s   
 (   
  
 & & / A +~Kn ~KB$~ $N; ;23^ 3$t;n t;n%~ %"N 0N B;<~ ;<|D^ D0<8^ <8~=> =r)   