#NEWLINE# def basic_post( kvl , tfidf , allow_store , mock_tm ) : #NEWLINE# #INDENT# request = Empty ( ) #NEWLINE# request . headers = { #NEWLINE# #INDENT# 'content-type' : 'application/json' , #NEWLINE# #UNINDENT# } #NEWLINE# data = { #NEWLINE# #INDENT# 'store' : allow_store , #NEWLINE# 'body' : bad_html , #NEWLINE# 'content-location' : 'fooooo' , #NEWLINE# 'content-type' : 'text/html' , #NEWLINE# 'last-modified' : '' , #NEWLINE# #UNINDENT# } #NEWLINE# request . body = StringIO ( json . dumps ( data ) ) #NEWLINE# response = Empty ( ) #NEWLINE# results = v1_highlights_post ( request , response , kvl , tfidf , min_delay = 0 , task_master = mock_tm ) #NEWLINE# max_loops = 10 #NEWLINE# loops = 0 #NEWLINE# while ( ( results [ 'state' ] == 'pending' ) and ( loops < max_loops ) ) : #NEWLINE# #INDENT# loops += 1 #NEWLINE# results = v1_highlights_get ( response , kvl , results [ 'id' ] ) #NEWLINE# logger . info ( results ) #NEWLINE# time . sleep ( 0.1 ) #NEWLINE# #UNINDENT# assert results #NEWLINE# assert ( len ( results [ 'highlights' ] ) == 2 ) #NEWLINE# assert ( len ( results [ 'highlights' ] [ 0 ] [ 'regexes' ] ) == 1 ) #NEWLINE# assert ( len ( results [ 'highlights' ] [ 1 ] [ 'xranges' ] ) == 1 ) #NEWLINE# return results