#NEWLINE# def testBasic( self ) : #NEWLINE# #INDENT# '\n        Set up a stream, and act as if resource binding succeeds.\n        ' #NEWLINE# def onBind( iq ) : #NEWLINE# #INDENT# response = xmlstream . toResponse ( iq , 'result' ) #NEWLINE# response . addElement ( ( NS_BIND , 'bind' ) ) #NEWLINE# response . bind . addElement ( 'jid' , content = 'user@example.com/other resource' ) #NEWLINE# self . pipe . source . send ( response ) #NEWLINE# #UNINDENT# def cb( result ) : #NEWLINE# #INDENT# self . assertEquals ( jid . JID ( 'user@example.com/other resource' ) , self . authenticator . jid ) #NEWLINE# #UNINDENT# d1 = self . waitFor ( IQ_BIND_SET , onBind ) #NEWLINE# d2 = self . init . start ( ) #NEWLINE# d2 . addCallback ( cb ) #NEWLINE# return defer . gatherResults ( [ d1 , d2 ] )