#NEWLINE# @ defer . inlineCallbacks #NEWLINE# def setUp( self ) : #NEWLINE# #INDENT# self . mock_resource = MockHttpResource ( prefix = PATH_PREFIX ) #NEWLINE# self . mock_handler = Mock ( spec = [ 'get_displayname' , 'set_displayname' , 'get_avatar_url' , 'set_avatar_url' ] ) #NEWLINE# hs = ( yield setup_test_homeserver ( 'test' , http_client = None , resource_for_client = self . mock_resource , federation = Mock ( ) , replication_layer = Mock ( ) ) ) #NEWLINE# def _get_user_by_req( request = None , allow_guest = False ) : #NEWLINE# #INDENT# return Requester ( UserID . from_string ( myid ) , '' , False ) #NEWLINE# #UNINDENT# hs . get_v1auth ( ) . get_user_by_req = _get_user_by_req #NEWLINE# hs . get_handlers ( ) . profile_handler = _get_user_by_req . mock_handler #NEWLINE# profile . register_servlets ( hs , self . mock_resource )