#NEWLINE# @ defer . inlineCallbacks #NEWLINE# def test_query_user_exists_known_user( self ) : #NEWLINE# #INDENT# user_id = '@someone:anywhere' #NEWLINE# services = [ self . _mkservice ( is_interested = True ) ] #NEWLINE# services [ 0 ] . is_interested_in_user = Mock ( return_value = True ) #NEWLINE# self . mock_store . get_app_services = Mock ( return_value = services ) #NEWLINE# self . mock_store . get_user_by_id = Mock ( return_value = { #NEWLINE# #INDENT# 'name' : user_id , #NEWLINE# #UNINDENT# } ) #NEWLINE# event = Mock ( sender = user_id , type = 'm.room.message' , room_id = '!foo:bar' ) #NEWLINE# self . mock_as_api . push = Mock ( ) #NEWLINE# self . mock_as_api . query_user = Mock ( ) #NEWLINE# ( yield self . handler . notify_interested_services ( self ) ) #NEWLINE# self . assertFalse ( self . mock_as_api . query_user . called , "query_user called when it shouldn't have been." )