#NEWLINE# def test_attach_endpoint_to_outport( inport , outport ) : #NEWLINE# #INDENT# outport . owner . did_connect = Mock ( ) #NEWLINE# old_endpoint = LocalOutEndpoint ( OutPort ( 'out' , actor ( ) ) , InPort ( 'out' , actor ( ) ) ) #NEWLINE# endpoint = LocalOutEndpoint ( outport , inport ) #NEWLINE# outport . attach_endpoint ( old_endpoint ) #NEWLINE# assert outport . is_connected_to ( old_endpoint . peer_id ) #NEWLINE# outport . attach_endpoint ( endpoint ) #NEWLINE# assert outport . is_connected_to ( endpoint . peer_id ) #NEWLINE# assert outport . is_connected_to ( old_endpoint . peer_id ) #NEWLINE# assert outport . owner . did_connect . called