#NEWLINE# def testWho( self ) : #NEWLINE# #INDENT# group = service . Group ( 'groupname' ) #NEWLINE# add = wFD ( self . realm . addGroup ( group ) ) #NEWLINE# ( yield add ) #NEWLINE# add . getResult ( ) #NEWLINE# users = [ ] #NEWLINE# for nick in ( 'userone' , 'usertwo' , 'userthree' ) : #NEWLINE# #INDENT# u = wFD ( self . _loggedInUser ( nick ) ) #NEWLINE# ( yield u ) #NEWLINE# u = u . getResult ( ) #NEWLINE# users . append ( u ) #NEWLINE# users [ ( - 1 ) ] . write ( 'JOIN #groupname\r\n' ) #NEWLINE# #UNINDENT# for user in users : #NEWLINE# #INDENT# user . transport . clear ( ) #NEWLINE# #UNINDENT# users [ 0 ] . write ( 'WHO #groupname\r\n' ) #NEWLINE# r = self . _response ( users [ 0 ] ) #NEWLINE# self . failIf ( self . _response ( users [ 1 ] ) ) #NEWLINE# self . failIf ( self . _response ( users [ 2 ] ) ) #NEWLINE# wantusers = [ 'userone' , 'usertwo' , 'userthree' ] #NEWLINE# for ( prefix , code , stuff ) in r [ : ( - 1 ) ] : #NEWLINE# #INDENT# self . assertEquals ( prefix , 'realmname' ) #NEWLINE# self . assertEquals ( code , '352' ) #NEWLINE# ( myname , group , theirname , theirhost , theirserver , theirnick , flag , extra ) = stuff #NEWLINE# self . assertEquals ( myname , 'userone' ) #NEWLINE# self . assertEquals ( group , '#groupname' ) #NEWLINE# self . failUnless ( ( theirname in wantusers ) ) #NEWLINE# self . assertEquals ( theirhost , 'realmname' ) #NEWLINE# self . assertEquals ( theirserver , 'realmname' ) #NEWLINE# wantusers . remove ( theirnick ) #NEWLINE# self . assertEquals ( flag , 'H' ) #NEWLINE# self . assertEquals ( extra , ( '0 ' + theirnick ) ) #NEWLINE# #UNINDENT# self . failIf ( wantusers ) #NEWLINE# ( prefix , code , stuff ) = self [ ( - 1 ) ] #NEWLINE# self . assertEquals ( prefix , 'realmname' ) #NEWLINE# self . assertEquals ( code , '315' ) #NEWLINE# ( myname , channel , extra ) = stuff #NEWLINE# self . assertEquals ( myname , 'userone' ) #NEWLINE# self . assertEquals ( channel , '#groupname' ) #NEWLINE# self . assertEquals ( extra , 'End of /WHO list.' )