#NEWLINE# def test_event( self ) : #NEWLINE# #INDENT# title = ' Testing events from dogshell' #NEWLINE# body = '%%%\n*Cool!*\n%%%\n' #NEWLINE# tags = 'tag:a,tag:b' #NEWLINE# cmd = [ 'event' , 'post' , title , '--tags' , tags ] #NEWLINE# event_id = None #NEWLINE# def match_permalink( out ) : #NEWLINE# #INDENT# match = re . match ( '.*/event/jump_to\\?event_id=([0-9]*)' , out , re . DOTALL ) #NEWLINE# if match : #NEWLINE# #INDENT# return match . group ( 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# #UNINDENT# ( out , err , return_code ) = self . dogshell ( cmd , stdin = body ) #NEWLINE# event_id = match_permalink ( out ) #NEWLINE# assert event_id , out #NEWLINE# time . sleep ( 2 ) #NEWLINE# cmd = [ 'event' , 'show' , event_id ] #NEWLINE# ( out , err , return_code ) = self . dogshell ( cmd ) #NEWLINE# event_id2 = match_permalink ( out ) #NEWLINE# self . assertEquals ( event_id , event_id2 ) #NEWLINE# cmd = [ 'event' , 'stream' , '30m' , '--tags' , tags ] #NEWLINE# ( out , err , return_code ) = self . dogshell ( cmd ) #NEWLINE# event_ids = ( match_permalink ( event_id ) for l in out . split ( '\n' ) ) #NEWLINE# event_ids = set ( [ e for e in event_ids if e ] ) #NEWLINE# assert ( event_id in event_ids )