+
    Dfjo                        R t ^ RIt^ RIHtHtHt ^ RIHtHtH	t	 ^ RI
HtHtHtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHtHt ^ R	IHt  ! R
 R]P4                  4      t ! R R4      t ! R R]P4                  4      t ! R R]P<                  4      t]P@                  ! ]]PB                  4        ! R R]P4                  4      t"R# )z%
Tests for L{twisted.words.service}.
N)checkerscredentialsportal)addressdeferreactor)DeferredDeferredListmaybeDeferredsucceed)pb)proto_helpers)unittest)ewordsservice)ircc                   V   a  ] tR t^t o R tR tR tR tR tR t	R t
R tR	 tR
tV tR# )
RealmTestsc                >   \         P                  ! R 4      pRVP                  4       ,           p\        VRVP	                  4       ,           4      p\        VRVP	                  4       ,           4      pRVP	                  4       ,           R,           p\        \
        RVP	                  4       ,           4      p\        \
        RVP	                  4       ,           4      pV P                  V! V4      4      p	V P                  W9P                  4       V P                  V! V4      4      P                  V4       \        W&R4       V P                  V! RVP                  4       ,           4      4      p	V P                  RVP                  4       ,           V	P                  4       V P                  V! RVP                  4       ,           4      4      p
V P                  W4       \        W&R	4       V P                  V! R
VP                  4       ,           4      4      P                  V4       R# )	realmnametestcreateget	OnRequest	DuplicateNoSuchTnewFanotherN)r   InMemoryWordsRealmlowergetattrtitler   successResultOfassertEqualnamefailureResultOftrapsetattrassertIdentical)selfkindrealmr$   r   r   flagdupExc	noSuchExcpnewps   &&         A/usr/lib/python3/dist-packages/twisted/words/test/test_service.py_entityCreationTestRealmTests._entityCreationTest   s   **;7

$4::< 78eUTZZ\12$**,&4tzz|!;<FHtzz|$;<	   .vv& 	VD\*//7 	T"  UTZZ\%9!:;-qvv6 ##C

(<$=>Q% 	U#STZZ\!9:;@@K    c                $    V P                  R 4      # )Userr2   r)   s   &r1   testUserCreationRealmTests.testUserCreation4   s    ''//r4   c                $    V P                  R 4      # )Groupr7   r8   s   &r1   testGroupCreationRealmTests.testGroupCreation7   s    ''00r4   c                   \         P                  ! R 4      pV P                  VP                  R4      4      pV P                  VP	                  R4      4      pV P                  W#4       V P                  VP                  R4      4      pV P                  W44       V P                  VP                  R4      4      P                  \        P                  4       R# )r   testuser
nosuchuserN)r   r   r"   
createUsergetUserr(   
lookupUserr%   r&   r   
NoSuchUser)r)   r+   user	retrievedlookedUps   &    r1   testUserRetrievalRealmTests.testUserRetrieval:   s    **;7 ##E$4$4Z$@A ((z)BC	T- ''(8(8(DEY1 
		e..|<	=	B	B6CTCT	Ur4   c                   \         P                  ! R 4      p\         P                  ! R4      pV P                  VP	                  V4      4      pV P                  W#4       V P                  VP                  R4      4      pV P                  W44       V P                  VP                  R4      4      pV P                  WE4       R# )r   r@   N)r   r   r6   r"   addUserr(   rC   rD   )r)   r+   r/   rF   rG   rH   s   &     r1   testUserAdditionRealmTests.testUserAdditionK   s    **;7 LL$##EMM!$45Q% ((z)BC	T- ''(8(8(DEY1r4   c                N   \         P                  ! R 4      pV P                  VP                  R4      4      pV P                  VP	                  R4      4      pV P                  W#4       V P                  VP	                  R4      4      P                  \        P                  4       R# )r   	testgroupnosuchgroupN)
r   r   r"   createGroupgetGroupr(   r%   r&   r   NoSuchGroup)r)   r+   grouprG   s   &   r1   testGroupRetrievalRealmTests.testGroupRetrieval[   s|    **;7$$U%6%6{%CD(()DE	U.			enn];	<	A	A&BTBT	Ur4   c                    \         P                  ! R 4      p\         P                  ! R4      pV P                  VP	                  V4      4       V P                  VP                  R4      4      pV P                  W#4       R# )r   rP   	testGroupN)r   r   r<   r"   addGrouprS   r(   )r)   r+   r/   rU   s   &   r1   testGroupAdditionRealmTests.testGroupAdditionf   s^    **;7MM+&U^^A./$$U^^K%@AQ&r4   c                    \         P                  ! R4      pV P                  VP                  R4      4       V P                  VP	                  R4      4       R# )z
Try creating a group with the same name as an existing user and
assert that it succeeds, since users and groups should not be in the
same namespace and collisions should be impossible.
r   r   N)r   r   r"   rB   rR   )r)   r+   s   & r1   testGroupUsernameCollision%RealmTests.testGroupUsernameCollisionn   sF     **;7U--f56U..v67r4   c                v   \         P                  ! R 4      pV P                  VP                  R4      4       V P                  VP                  R4      4       V P                  VP	                  4       4      pV Uu. uF  q3P
                  NK  	  ppVP                  4        V P                  VRR.4       R# u upi )r   grouponegrouptwoN)r   r   r"   rR   
itergroupsr$   sortr#   )r)   r+   groupsgns   &    r1   testEnumerationRealmTests.testEnumerationy   s    **;7U..z:;U..z:;%%e&6&6&89#$VVVV$	Z45 %s   :B6 N)__name__
__module____qualname____firstlineno__r2   r9   r=   rI   rM   rV   r[   r^   rh   __static_attributes____classdictcell____classdict__s   @r1   r   r      s:     L>01W"2 	W'	8
6 
6r4   r   c                   V   a  ] tR t^t o ]P
                  ! RRR4      3R ltR tRtV t	R# )TestCaseUserAggTCP	127.0.0.1i1  c                (   Wn         \        P                  ! 4       V n        VP	                  V4      V n        V P
                  V P                  n        V P
                  V P                   n        V P
                  P                  V P                  4       R # N)rF   r    StringTransportWithDisconnection	transportbuildProtocolprotocolmindmakeConnection)r)   rF   r+   factoryr   s   &&&&&r1   __init__TestCaseUserAgg.__init__   s`     	&GGI--g6"&--		$$T^^4r4   c                <    V P                   P                  V4       R # rx   )r|   dataReceived)r)   stuffs   &&r1   writeTestCaseUserAgg.write   s    ""5)r4   )r|   rz   rF   N)
rk   rl   rm   rn   r   IPv4Addressr   r   ro   rp   rq   s   @r1   rt   rt      s(      ##E;>5* *r4   rt   c                      a  ] tR t^t o . ROtR tR tRR ltR tRR lt	R t
R tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tRtV tR# )IRCProtocolTestsc                T   \         P                  ! R 4      V n        \        P                  ! 4       V n        \        P                  ! V P                  V P
                  .4      V n        \         P                  ! V P                  V P                  4      V n	        . pV P                   Fv  p\        V\        4      '       d   VP                  R4      pVP                  V P                  P                  V4      4       V P
                  P!                  W"R,           4       Kx  	  \#        V4      # )r   utf-8	_password)r   r   r+   r   'InMemoryUsernamePasswordDatabaseDontUsecheckerr   Portal
IRCFactoryr   STATIC_USERS
isinstancebytesdecodeappendrB   rL   r	   )r)   cnicks   &  r1   setUpIRCProtocolTests.setUp   s    //<
GGImmDJJ?))$**dkkB%%D$&&{{7+HHTZZ**401LL  k'9:	 &
 Ar4   c                   V P                  V4      p\        P                  \        P                  \        P                  \        P
                  .pV F  w  rEpWS9   g   K  VP                  V4       K!  	  V P                  VRV: 24       R# )z
The user has been greeted with the four messages that are (usually)
considered to start an IRC session.

Asserts that the required responses were received.
zMissing responses for N)	_responser   RPL_WELCOMERPL_YOURHOSTRPL_CREATED
RPL_MYINFOremoveassertFalse)r)   rF   responseexpectedprefixcommandargss   &&     r1   _assertGreeting IRCProtocolTests._assertGreeting   sm     >>$'OOS%5%5sW%-!FT"( &. 	%;H<#HIr4   Nc                t    Vf
   VR,           pVP                  RV R24       VP                  RV R24       R # )Nr   zPASS z
zNICK z extrainfo
)r   )r)   rF   r   passwords   &&&&r1   _loginIRCProtocolTests._login   s<    k)H

U8*D)*

U4&/0r4   c                    V P                  V P                  P                  V4      4      p\        W P                  V P                  4      pV P                  W14       V# rx   )r"   r+   rD   rt   r   r   )r)   r$   rF   aggs   &&  r1   _loggedInUserIRCProtocolTests._loggedInUser   sF    ##DJJ$9$9$$?@dJJ=C
r4   c                @   VP                   P                  4       pVP                  R4      pVP                  4       pVP                   P	                  4        . p\        \        P                  V4       F(  pVe   V^,          V8X  g   K  VP                  V4       K*  	  V# )z
Extracts the user's response, and returns a list of parsed lines.
If messageType is defined, only messages of that type will be returned.
r   )	rz   valuer   
splitlinesclearmapr   parsemsgr   )r)   rF   messageTyper   resultmessages   &&&   r1   r   IRCProtocolTests._response   s    
 >>'')??7+&&(3<<2G"gajK&?g& 3 r4   c                J    V P                  R 4      pV P                  V4       R# )	firstuserN)r   r   )r)   rF   s   & r1   testPASSLoginIRCProtocolTests.testPASSLogin   s     !!+.T"r4   c                n   V P                  V P                  P                  R4      4      p\        WP                  V P                  4      pVP                  R4       V P                  VR4      pV P                  \        V4      ^4       V P                  V^ ,          ^ ,          \        P                  4       V P                  V^ ,          ^,          R4       V P                  V^ ,          ^,          RR.4       VP                  P                  4        VP                  R4       V P                  V4       R# )z
Sending NICK without PASS will prompt the user for their password.
When the user sends their password to NickServ, it will respond with a
Greeting.
r   zNICK firstuser extrainfo
PRIVMSGz	Password?z%PRIVMSG nickserv firstuser_password
N)r"   r+   rD   rt   r   r   r   r#   lenr   NICKSERVrz   r   r   r)   r   rF   r   s   &   r1   test_nickServLogin#IRCProtocolTests.test_nickServLogin   s     (()>)>{)KL	y**dllC

12>>$	2X*!Q)9)9:!Q3!Q+{)CD

<=T"r4   c                ^   V P                  V P                  P                  R 4      4      p\        WP                  V P                  4      pV P                  VR R4       V P                  VR4      pV P                  \        V4      ^4       V P                  V^ ,          ^,          R R.4       R# )r   	wrongpassr   zLogin failed.  Goodbye.N)	r"   r+   rD   rt   r   r   r   r#   r   r   s   &   r1   testFailedLogin IRCProtocolTests.testFailedLogin   s    (()>)>{)KL	y**dllCD+{3>>$	2X*!Q+7P)QRr4   c                6  a . oV P                  V P                  P                  R 4      4      p\        WP                  V P                  4      pV P                  VR 4       V3R lVP                  n        VP                  R4       V P                  SR.4       R# )r   c                  &   < S P                  R 4      # )T)r   )logouts   r1   <lambda>-IRCProtocolTests.testLogout.<locals>.<lambda>  s    v}}T':r4   zQUIT
TN)
r"   r+   rD   rt   r   r   r|   r   r   r#   )r)   r   rF   r   s   &  @r1   
testLogoutIRCProtocolTests.testLogout  ss    (()>)>{)KL	y**dllCD+&:

:$(r4   c                T   V P                  V P                  P                  R 4      4      pV P                  V P                  P                  R4      4      pRVP                  R&   \        WP                  V P                  4      pV P                  VR 4       VP                  P                  4        VP                  R4       V P                  V4      pV P                  \        V4      ^4       V P                  V^ ,          ^ ,          R4       V P                  V^ ,          ^,          R4       V P                  V^ ,          ^,          R.4       V P                  V^,          ^,          R4       V P                  V^,          ^,          R	4       V P                  V^,          ^,          R
4       V P                  V^,          ^,          R4       V P                  R4      pVP                  P                  4        VP                  P                  4        VP                  R4       V P                  V4      pV P                  V4      pV P                  \        V4      ^4       V P                  V^ ,          ^ ,          R4       V P                  V^ ,          ^,          R4       V P                  V^ ,          ^,          R.4       V P                  V^,          ^ ,          R4       V P                  V^,          ^,          R4       V P                  V^,          ^,          . RO. RO.4       R# )r   somechannelzsome random topictopicJOIN #somechannel
zfirstuser!firstuser@realmnameJOIN#somechannel353366332333	otheruserotheruser!otheruser@realmnamer   N)r   =r   zfirstuser otheruser)r   r   r   zotheruser firstuser)r"   r+   rD   rR   metart   r   r   rz   r   r   r   r#   r   r   assertIn)r)   r   r   rF   r   otherevents   &      r1   testJoinIRCProtocolTests.testJoin  st   (()>)>{)KL	**4::+A+A-+PQ$7! y**dllCD+&

*+>>$'X* 	!Q)HI!Q0!Q.)9: 	!Q/!Q/ 	!Q/!Q/ "";/+, >>%(t$UQ'q!&EFq!f-q!~&67!Q5!Q/QKNII	
r4   c                
   V P                  V P                  P                  R4      4      pV P                  V P                  P                  R4      4       \	        WP                  V P
                  4      pV P                  VR4       VP                  P                  4        VP                  R4       V P                  V4      pV Uu. uF  qD^,          NK  	  ppV P                  RV4       V P                  RV4       R# u upi )zW
When a user joins a group without a topic, no topic information is
sent to that user.
r   r   r   r   r   N)r"   r+   rD   rR   rt   r   r   rz   r   r   r   assertNotIn)r)   r   rF   r   rresponseCodess   &     r1   test_joinTopicless#IRCProtocolTests.test_joinTopiclessB  s    
 (()>)>{)KL	TZZ33MBC y**dllCD+&

*+>>$''/0x!1x0.. 1s   D c                   V P                  R 4      pV P                  V P                  P                  R4      4       VP	                  R4       VP
                  P                  4        V P                  R4      pVP	                  R4       VP
                  P                  4        VP
                  P                  4        VP	                  R4       V P                  V4      pV P                  V4      pV P                  \        V4      ^4       V P                  V^ ,          ^ ,          R4       V P                  V^ ,          ^,          R4       V P                  V^ ,          ^,          RR.4       V P                  W44       VP	                  R4       VP
                  P                  4        VP
                  P                  4        VP	                  R	4       V P                  V4      pV P                  V4      pV P                  \        V4      ^4       V P                  V^ ,          ^ ,          R4       V P                  V^ ,          ^,          R4       V P                  V^ ,          ^,          RR
.4       V P                  W44       VP	                  R4       VP
                  P                  4        VP
                  P                  4        VP	                  R4       V P                  V4      pV P                  V4      pV P                  \        V4      ^4       V P                  V^ ,          ^ ,          R4       V P                  V^ ,          ^,          R4       V P                  V^ ,          ^,          RR.4       V P                  W44       R# )useruserr   r   r   zPART #somechannel
useruser!useruser@realmnamePARTr   leavingz(PART #somechannel :goodbye stupidheads
zgoodbye stupidheadss   JOIN #somechannel
s)   PART #somechannel :goodbye stupidheads1
zgoodbye stupidheads1N
r   r"   r+   rR   r   rz   r   r   r#   r   r)   rF   r   r   r   s   &    r1   	testLeaveIRCProtocolTests.testLeaveV  s   !!*-TZZ33MBC

*+"";/+,

*+>>$'u%X*!Q)FG!Q0!Q.))DE) 	

*+

?@>>$'u%X*!Q)FG!Q0!Q.:O)PQ)

+,

AB>>$'u%X*!Q)FG!Q0!Q.:P)QR)r4   c                B   V P                  R 4      p\        P                  ! R4      pRVP                  R&   RVP                  R&   RVP                  R&   V P	                  V P
                  P                  V4      4       VP                  P                  4        VP                  R4       V P                  V4      pV P                  V^,          ^ ,          R	4       V P                  V^,          ^,          R
4       V P                  V^,          ^,          . RO4       V P                  V^,          ^,          R4       V P                  V^,          ^,          . RO4       VP                  P                  4        VP                  R4       V P                  V4      pV P                  V^ ,          ^,          R
4       V P                  V^ ,          ^,          . RO4       V P                  V^,          ^,          R4       V P                  V^,          ^,          . RO4       R# )r   r   This is a test topic.r   some_fellowtopic_authoriqˢ
topic_dater   r   r   r   TOPIC #somechannel
N)r   r   r   )r   r   r   77777777)r   r   r<   r   r"   r+   rZ   rz   r   r   r   r#   )r)   rF   rU   r   s   &   r1   testGetTopicIRCProtocolTests.testGetTopic  s   !!*-m,5

7%2

>"#+

< TZZ0078

*+>>$'!Q5!Q/ 	QKNQ	
 	!Q/QKNS	
 	

+,>>$'!Q/QKNQ	
 	!Q/QKNS	
r4   c                   V P                  R 4      pV P                  V P                  P                  R4      4      pVP	                  R4       V P                  R4      pVP	                  R4       VP
                  P                  4        VP
                  P                  4        VP	                  R4       V P                  V4      pV P                  V4      pV P                  WE4       V P                  V^ ,          ^ ,          R4       V P                  V^ ,          ^,          R4       V P                  V^ ,          ^,          RR.4       VP
                  P                  4        R	VP                  R
&   VP	                  R4       V P                  V4      pV P                  V^ ,          ^,          R4       V P                  V^ ,          ^,          . RO4       V P                  V^,          ^,          R4       V P                  V^,          ^,          . RO4       VP
                  P                  4        VP	                  R4       V P                  V4      pV P                  V^ ,          ^,          R4       R# )r   r   r   r   z,TOPIC #somechannel :This is the new topic.
r   TOPICr   This is the new topic.i90  r   r   r   r   zTOPIC #asdlkjasd
403N)r   r   r   )r   r   r   12345)
r   r"   r+   rR   r   rz   r   r   r#   r   )r)   rF   r   r   r   r   s   &     r1   testSetTopicIRCProtocolTests.testSetTopic  s   !!*-**4::+A+A-+PQ

*+"";/+,DE>>%(t$)!Q)HI!Q1!Q.:R)ST).&,->>%(!Q/QKNS	
 	!Q/QKNO	
 	*+>>%(!Q/r4   c                   V P                  R 4      pV P                  V P                  P                  R4      4       VP	                  R4       V P                  R4      pVP	                  R4       VP
                  P                  4        VP
                  P                  4        VP	                  R4       V P                  V4      pV P                  V4      pV P                  V4       V P                  \        V4      ^4       V P                  V^ ,          ^ ,          R4       V P                  V^ ,          ^,          RR
4       V P                  V^ ,          ^,          RR.4       R	# )r   r   r   r   z%PRIVMSG #somechannel :Hello, world.
r   r   r   zHello, world.N)r   r"   r+   rR   r   rz   r   r   r   r#   r   r   s   &    r1   testGroupMessage!IRCProtocolTests.testGroupMessage  s   !!*-TZZ33MBC

*+"";/+,

<=>>$'u%"UQ'q!&CDq!i4q!~&GHr4   c                r   V P                  R 4      pV P                  R4      pVP                  P                  4        VP                  P                  4        VP                  R4       V P	                  V4      pV P	                  V4      pV P                  V4       V P                  \        V4      ^4       V P                  V^ ,          ^ ,          R4       V P                  V^ ,          ^,          R4       V P                  V^ ,          ^,          RR.4       VP                  R4       V P	                  V4      pV P                  \        V4      ^4       V P                  V^ ,          ^ ,          R4       V P                  V^ ,          ^,          R4       V P                  V^ ,          ^,          . R
O4       R	# )r   r   z#PRIVMSG otheruser :Hello, monkey.
r   r   zHello, monkey.z)PRIVMSG nousernamedthis :Hello, monkey.
r   401N)r   nousernamedthiszNo such nick/channel.)r   rz   r   r   r   r   r#   r   r   s   &    r1   testPrivateMessage#IRCProtocolTests.testPrivateMessage  sW   !!*-"";/

:;>>$'u%"UQ'q!&CDq!i0q!{4D&EF

@A>>$'X*!Q5!Q/QKNT	
r4   c                   V P                  R 4      pVP                  P                  4        VP                  R4       V P	                  V4      pV P                  \        V4      ^4       V P                  V^ ,          ^,          R4       R# )r   zOPER user pass
491Nr   rz   r   r   r   r#   r   r)   rF   r   s   &  r1   testOperIRCProtocolTests.testOper   si    !!*-

'(>>$'X*!Q/r4   c                   V P                  R 4      pVP                  P                  4        VP                  R4       V P	                  V4      pV P                  \        V4      ^4       V P                  V^ ,          ^ ,          R4       V P                  V^ ,          ^,          R4       V P                  V^ ,          ^,          R R.4       R# )r   zMODE useruser
r   221+Nr  r  s   &  r1   testGetUserMode IRCProtocolTests.testGetUserMode*  s    !!*-

&'>>$'X*!Q5!Q/!Q*c):;r4   c                   V P                  R 4      pVP                  P                  4        VP                  R4       V P	                  V4      pV P                  \        V4      ^4       V P                  V^ ,          ^,          R4       R# )r   zMODE useruser +abcd
472Nr  r  s   &  r1   testSetUserMode IRCProtocolTests.testSetUserMode6  si    !!*-

,->>$'X*!Q/r4   c                   V P                  R 4      pV P                  V P                  P                  R4      4       VP	                  R4       VP
                  P                  4        VP	                  R4       V P                  V4      pV P                  \        V4      ^4       V P                  V^ ,          ^,          R4       R# )r   r   r   zMODE #somechannel
324Nr   r  s   &  r1   testGetGroupMode!IRCProtocolTests.testGetGroupMode@  s    !!*-TZZ33MBC

*+

*+>>$'X*!Q/r4   c                   V P                  R 4      pV P                  V P                  P                  R4      4       VP	                  R4       VP
                  P                  4        VP	                  R4       V P                  V4      pV P                  \        V4      ^4       V P                  V^ ,          ^,          R4       R# )r   	groupnameJOIN #groupname
zMODE #groupname +abcd
r  Nr   r  s   &  r1   testSetGroupMode!IRCProtocolTests.testSetGroupModeN  s    !!*-TZZ33K@A

()

./>>$'X*!Q/r4   c           	        \         P                  ! R 4      pV P                  V P                  P	                  V4      4       . pR F=  pV P                  V4      pVP                  V4       VR,          P                  R4       K?  	  V F  pVP                  P                  4        K  	  V^ ,          P                  R4       V P                  V^ ,          4      pV P                  V P                  V^,          4      4       V P                  V P                  V^,          4      4       . ROpVRR  F  w  rp
V P                  VR4       V P                  V	R4       V
w  ppppppppV P                  VR4       V P                  VR4       V P                  W9   4       V P                  VR4       V P                  VR4       VP                  V4       V P                  VR4       V P                  VR	V,           4       K  	  V P                  V4       VR,          w  rp
V P                  VR4       V P                  V	R
4       V
w  pppV P                  VR4       V P                  VR4       V P                  VR4       R# )r   useroner!  zWHO #groupname
Nr   352z
#groupnameHz0 315zEnd of /WHO list.)r%  usertwo	userthreer  )r   r<   r"   r+   rZ   r   r   r   rz   r   r   r   r#   
assertTruer   )r)   rU   usersr   urF   r   	wantusersr   coder   myname	theirname	theirhosttheirserver	theirnickr,   extrachannels   &                  r1   testWhoIRCProtocolTests.testWho\  s8   k*TZZ00785D""4(ALLO"IOO12 6 DNN  "  	a+,NN58$a12a127	#$Sb6F%V[1T5) 	VY/UL1OOI23Y4[+6Y'T3'UD9$45+ $*, 	#ee-u%!&+,/ 34r4   c                   V P                  R 4      pVP                  P                  4        V P                  V P                  P                  R4      4      pR Vn        RVP                  R&   VP                  R4       V P                  V4      pV P                  \        V4      ^4       Vw  rEV P                  V^ ,          R4       V P                  V^,          R4       V P                  V^,          ^ ,          R 4       V P                  V^,          ^,          R4       V P                  V^,          ^,          R4       V P                  V^,          ^,          R4       V P                  V^ ,          R4       V P                  V^,          R	4       V P                  V^,          ^ ,          R 4       V P                  V^,          ^,          R
4       VP                  P                  4        VP                  R4       V P                  V4      pV P                  \        V4      ^4       Vw  reV P                  V^,          R4       V P                  V^,          ^,          R4       V P                  V^,          ^,          R4       V P                  V^,          ^,          R4       V P                  V^,          R	4       R# )someuser	somegroupc                      \        ^4      # )   )r   rj   r4   r1   r   +IRCProtocolTests.testList.<locals>.<lambda>  s    r4   zthis is the topic woor   zLIST #somegroup
r   32217323zEnd of /LISTzLIST
N)r   rz   r   r"   r+   rR   sizer   r   r   r#   r   )r)   rF   r;  r   respendfg1s   &      r1   testListIRCProtocolTests.testList  s'   !!*-(()?)?)LM	,	"9	w 	

()NN4 Q#	a+.a%(aZ0a[1aT*a%<=Q-Q'QJ/QN3 	

:NN4 Q#Q'QK0QD)Q$;<Q'r4   c                   V P                  R 4      p\        P                  ! R4      pR Vn        ^
Vn        \
        P
                  ! 4       ^,
          Vn        V P                  V P                  P                  V4      4       VP                  P                  4        VP                  R4       V P                  V4      pV P                  \        V4      ^4       Vw  rErgpV P                  V^ ,          R4       V P                  V^,          R4       V P                  V^,          ^ ,          R 4       V P                  V^,          ^,          R4       V P                  V^,          ^,          R4       V P                  V^,          ^,          R4       V P                  V^,          ^,          R4       V P                  V^,          ^,          R4       V P                  V^ ,          R4       V P                  V^,          R4       V P                  V^,          ^ ,          R 4       V P                  V^,          ^,          R4       V P                  V^,          ^,          R4       V P                  V^,          ^,          R4       V P                  V^ ,          R4       V P                  V^,          R	4       V P                  V^,          ^ ,          R 4       V P                  V^,          ^,          R4       V P                  V^,          ^,          R
4       V P                  V^,          ^,          R4       V P                  V^,          ^,          R4       V P                  V^ ,          R4       V P                  V^,          R4       V P                  V^,          ^ ,          R 4       V P                  V^,          ^,          R4       V P                  V^,          ^,          R4       V P                  V^ ,          R4       V P                  V^,          R4       V P                  V^,          ^ ,          R 4       V P                  V^,          ^,          R4       V P                  V^,          ^,          R4       R# )someguyotherguyc                  l    \        \        P                  ! R 4      \        P                  ! R4      .4      # )groupAgroupB)iterr   r<   rj   r4   r1   r   ,IRCProtocolTests.testWhois.<locals>.<lambda>  s#    d]]8$gmmH&=>'
r4   zWHOIS otherguy
r   311*312zHi mom!3171510zseconds idle, signon time319z#groupA #groupB318zEnd of WHOIS list.N)r   r   r6   rc   signOntimelastMessager"   r+   rL   rz   r   r   r   r#   r   )	r)   rF   rJ  r   wuserwserveridlechannelsrD  s	   &        r1   	testWhoisIRCProtocolTests.testWhois  sq   !!),<<
+
 #yy{R/TZZ//9:

'(NN4 Q#./+q;/q5)q!i0q!j1q!j1q!k2q!c*q!j1[1U+A	2A
3A4A	2a+.a%(aY/aZ0aT*aT*a%@A!k2!e,!Q3!Q4!Q):;Q-Q'QI.QJ/Q$89r4   )r   r   r   r+   )r   r   rI  r   usernamer%  r)  r*  userfours   userfiver:  rx   )rk   rl   rm   rn   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r
  r  r  r  r  r"  r7  rF  r_  ro   rp   rq   s   @r1   r   r      s     LJ1##(S)5
n/(9*v(
T,0\I2
<0
<00015f)(V5: 5:r4   r   c                   >   a  ] tR tRt o R tR tR tR tR tRt	V t
R# )	TestMindi  c                >    . V n         . V n        . V n        . V n        R # rx   )joinspartsmessagesr   )r)   akws   &*,r1   r   TestMind.__init__  s    

	r4   c                >    V P                   P                  W34       R # rx   )rf  r   )r)   rF   rU   s   &&&r1   remote_userJoinedTestMind.remote_userJoined  s    

4-(r4   c                @    V P                   P                  WV34       R # rx   )rg  r   )r)   rF   rU   reasons   &&&&r1   remote_userLeftTestMind.remote_userLeft  s    

4/0r4   c                @    V P                   P                  WV34       R # rx   )rh  r   )r)   sender	recipientr   s   &&&&r1   remote_receiveTestMind.remote_receive  s    f9:r4   c                >    V P                   P                  W34       R # rx   )r   r   )r)   rU   r   s   &&&r1   remote_groupMetaUpdateTestMind.remote_groupMetaUpdate  s    		%'r4   )rf  rh  r   rg  N)rk   rl   rm   rn   r   rm  rq  rv  ry  ro   rp   rq   s   @r1   rd  rd    s#     )1;( (r4   rd  c                   \   a  ] tR tRt o R tR tR tR t]P                  R 4       t
RtV tR# )	PBProtocolTestsi	  c                   \         P                  ! R 4      V n        \        P                  ! 4       V n        \        P                  ! V P                  V P
                  .4      V n        \        P                  ! V P                  4      V n
        V P                  V P                  n        RV P                  n        \        P                  ! 4       V n        RV P                  n        \         P"                  ! ^ V P                  4      V n        \         P&                  ! RV P$                  P)                  4       P*                  V P                  4      V n        R# )r   Trv   N)r   r   r+   r   r   r   r   r   r   PBServerFactoryserverFactory_protocolFactoryr|   unsafeTracebacksPBClientFactoryclientFactoryr   	listenTCP
serverPort
connectTCPgetHostport
clientConnr8   s   &r1   r   PBProtocolTests.setUp
  s    //<
GGImmDJJ?//<&*&;&;#.2+//1.2+!++At/A/AB!,,002779K9K
r4   c                P    \         P                  ! ^ 4      V n        V P                  # )    )r   Broker_serverProtocol)r)   r   rj  s   &*,r1   r   PBProtocolTests._protocolFactory  s    !yy|###r4   c                   a \        4       oV P                  P                  V3R  l4       \        \	        V P
                  P                  4      \	        V P                  P                  4      S.4      # )c                  &   < S P                  R 4      # rx   )callback)d3s   r1   r   *PBProtocolTests.tearDown.<locals>.<lambda>  s    D8Ir4   )	r   r  notifyOnDisconnectr	   r
   r  stopListeningr  
disconnect)r)   r  s   &@r1   tearDownPBProtocolTests.tearDown  sX    Z//0IJdoo;;<doo889
 	
r4   c                $  a aa Tp\        V\        4      '       d   VP                  R 4      p\        P                  ! WB4      oS P
                  P                  WB4       S P                  P                  V4      pVP                  VVV 3R l4       V# )asciic                 <   < SP                   P                  SS4      # rx   )r  login)igncredsr}   r)   s   &r1   r   1PBProtocolTests._loggedInAvatar.<locals>.<lambda>.  s    $"4"4":":5$"Gr4   )
r   strencoder   UsernamePasswordr   rL   r+   rB   addCallback)r)   r$   r   r}   	nameBytesdr  s   f&&f  @r1   _loggedInAvatarPBProtocolTests._loggedInAvatar'  sk    	dC  G,I,,YAY1JJ!!$'	GHr4   c              #  l  "   \        4       pV P                  R RV4      x p\        4       pV P                  RRV4      x p\        4       pV P                  RRV4      x pV P                  P                  R4      x  V P                  P                  R4      x  VP	                  R4      x pVP	                  R4      x pVP	                  R4      x  VP	                  R4      x  VP	                  R4      x  VP                  RR	/4      x  VP                  4       x  VP                  4       x  R
# 5i)ones   p1twos   p2s   threes   p3foobars   barfoos   texts   hello, monkeysN)rd  r  r+   rR   joinsendleave)	r)   mindoner  mindtwor  	mindThreethreera   rb   s	   &        r1   
testGroupsPBProtocolTests.testGroups1  s    *((w??*((w??J	**8UIFFjj$$X..jj$$Y//(++),,hhx  hhy!!jj""mmW&7899nnnns   D2D4)r  r   r  r  r   r+   r  r  N)rk   rl   rm   rn   r   r  r  r  r   inlineCallbacksr  ro   rp   rq   s   @r1   r|  r|  	  s3     
$	
  r4   r|  )#__doc__rY  twisted.credr   r   r   twisted.internetr   r   r   twisted.internet.deferr   r	   r
   r   twisted.spreadr   twisted.testr   twisted.trialr   twisted.wordsr   r   twisted.words.protocolsr   TestCaser   rt   r   PBMindrd  setUnjellyableForClassPBMindReferencer|  rj   r4   r1   <module>r     s     6 6 4 4 Q Q  & " ) 'o6"" o6d* *&V	:x(( V	:r(w~~ ((   (G$;$; <@h'' @r4   