#NEWLINE# def test_getModeratorList( self ) : #NEWLINE# #INDENT# "\n        Retrieving the moderator returns a list of L{muc.AdminItem}s.\n\n        The request asks for the role C{'moderator'}.\n        " #NEWLINE# def cb( items ) : #NEWLINE# #INDENT# self . assertEquals ( 1 , len ( items ) ) #NEWLINE# item = items [ 0 ] #NEWLINE# self . assertEquals ( JID ( 'hag66@shakespeare.lit' ) , item . entity ) #NEWLINE# self . assertEquals ( 'thirdwitch' , item . nick ) #NEWLINE# self . assertEquals ( 'moderator' , item . role ) #NEWLINE# #UNINDENT# d = self . protocol . getModeratorList ( self . roomJID ) #NEWLINE# d . addCallback ( cb ) #NEWLINE# iq = self . stub . output [ ( - 1 ) ] #NEWLINE# self . assertEquals ( 'get' , iq . getAttribute ( 'type' ) ) #NEWLINE# query = ( "/iq/query[@xmlns='%s']/item[@xmlns='%s']" % ( muc . NS_MUC_ADMIN , muc . NS_MUC_ADMIN ) ) #NEWLINE# items = xpath . queryForNodes ( query , iq ) #NEWLINE# self . assertNotIdentical ( None , items ) #NEWLINE# self . assertEquals ( 1 , len ( items ) ) #NEWLINE# self . assertEquals ( 'moderator' , items [ 0 ] . getAttribute ( 'role' ) ) #NEWLINE# response = toResponse ( iq , 'result' ) #NEWLINE# query = response . addElement ( ( NS_MUC_ADMIN , 'query' ) ) #NEWLINE# item = query . addElement ( 'item' ) #NEWLINE# item [ 'affiliation' ] = 'member' #NEWLINE# item [ 'jid' ] = 'hag66@shakespeare.lit' #NEWLINE# item [ 'nick' ] = 'thirdwitch' #NEWLINE# item [ 'role' ] = 'moderator' #NEWLINE# self . stub . send ( response ) #NEWLINE# return d