#NEWLINE# def testRegister( self ) : #NEWLINE# #INDENT# self . register ( ) #NEWLINE# ( dest , m ) = dc . sent [ 0 ] #NEWLINE# self . assertEquals ( ( dest . host , dest . port ) , ( 'client.com' , 5060 ) ) #NEWLINE# self . assertEquals ( m . code , 200 ) #NEWLINE# self . assertEquals ( m . headers [ 'via' ] , [ 'SIP/2.0/UDP client.com:5060' ] ) #NEWLINE# self . assertEquals ( m . headers [ 'to' ] , [ 'sip:joe@bell.example.com' ] ) #NEWLINE# self . assertEquals ( m . headers [ 'contact' ] , [ 'sip:joe@client.com:5060' ] ) #NEWLINE# self . failUnless ( ( int ( m . headers [ 'expires' ] [ 0 ] ) in ( 3600 , 3601 , 3599 , 3598 ) ) ) #NEWLINE# self . assertEquals ( len ( self . registry . users ) , 1 ) #NEWLINE# ( dc , uri ) = self . registry . users [ 'joe' ] #NEWLINE# self . assertEquals ( uri . toString ( ) , 'sip:joe@client.com:5060' ) #NEWLINE# d = self . proxy . locator . getAddress ( sip . URL ( username = 'joe' , host = 'bell.example.com' ) ) #NEWLINE# d . addCallback ( ( lambda desturl : ( desturl . host , desturl . port ) ) ) #NEWLINE# d . addCallback ( self . assertEquals , ( 'client.com' , 5060 ) ) #NEWLINE# return d