#NEWLINE# def test_wiki_products( self ) : #NEWLINE# #INDENT# 'Make sure that adding products to a Document causes it to\n        refresh the index.\n\n        ' #NEWLINE# p = ProductFactory ( slug = 'desktop' ) #NEWLINE# eq_ ( DocumentMappingType . search ( ) . filter ( product = p . slug ) . count ( ) , 0 ) #NEWLINE# doc = DocumentFactory ( ) #NEWLINE# RevisionFactory ( document = doc , is_approved = True ) #NEWLINE# self . refresh ( ) #NEWLINE# eq_ ( DocumentMappingType . search ( ) . filter ( product = p . slug ) . count ( ) , 0 ) #NEWLINE# doc . products . add ( p ) #NEWLINE# self . refresh ( ) #NEWLINE# eq_ ( DocumentMappingType . search ( ) . filter ( product = p . slug ) . count ( ) , 1 ) #NEWLINE# doc . products . remove ( p ) #NEWLINE# self . refresh ( ) #NEWLINE# eq_ ( DocumentMappingType . search ( ) . filter ( ) . count ( ) , 1 ) #NEWLINE# eq_ ( DocumentMappingType . search ( ) . filter ( product = p . slug ) . count ( ) , 0 )