#NEWLINE# def test_register( self ) : #NEWLINE# #INDENT# '\n        Client registering with a room.\n\n        http://xmpp.org/extensions/xep-0045.html#register\n        ' #NEWLINE# def cb( iq ) : #NEWLINE# #INDENT# self . assertEquals ( 'result' , iq [ 'type' ] , 'We did not get a result' ) #NEWLINE# #UNINDENT# d = self . protocol . register ( self . roomJID , { #NEWLINE# #INDENT# 'muc#register_roomnick' : 'thirdwitch' , #NEWLINE# #UNINDENT# } ) #NEWLINE# d . addCallback ( cb ) #NEWLINE# iq = self . stub . output [ ( - 1 ) ] #NEWLINE# query = ( "/iq/query[@xmlns='%s']" % muc . NS_REGISTER ) #NEWLINE# nodes = xpath . queryForNodes ( query , iq ) #NEWLINE# self . assertNotIdentical ( None , nodes , 'Invalid registration request' ) #NEWLINE# form = data_form . findForm ( nodes [ 0 ] , muc . NS_MUC_REGISTER ) #NEWLINE# self . assertNotIdentical ( None , form , 'Missing registration form' ) #NEWLINE# self . assertEquals ( 'submit' , form . formType ) #NEWLINE# self . assertIn ( 'muc#register_roomnick' , form . fields ) #NEWLINE# response = toResponse ( iq , 'result' ) #NEWLINE# self . stub . send ( response ) #NEWLINE# return d