#NEWLINE# def _FetchLogs( self , user_id , start_date = None , start_timestamp = None , end_date = None , end_timestamp = None , filter = None , exp_logs = [ ] ) : #NEWLINE# #INDENT# "Calls the fetch_logs.FetchLogs method by setting command-line\n    options according to this method's parameters. Verifies the resulting\n    list of fetched urls and the contents of the locally saved log files.\n\n    Returns the resulting array of log urls from fetch_logs.FetchLogs().\n    " #NEWLINE# ( api_host , opener ) = self . _GetAdminOpener ( ) #NEWLINE# options . options . user_id = user_id #NEWLINE# options . options . start_date = None #NEWLINE# options . options . start_timestamp = None #NEWLINE# options . options . end_date = None #NEWLINE# options . options . end_timestamp = None #NEWLINE# options . options . filter = None #NEWLINE# if ( start_date is not None ) : #NEWLINE# #INDENT# options . options . start_date = start_date #NEWLINE# #UNINDENT# if ( start_timestamp is not None ) : #NEWLINE# #INDENT# options . options . start_timestamp = start_timestamp #NEWLINE# #UNINDENT# if ( end_date is not None ) : #NEWLINE# #INDENT# options . options . end_date = end_date #NEWLINE# #UNINDENT# if ( end_timestamp is not None ) : #NEWLINE# #INDENT# options . options . end_timestamp = end_date #NEWLINE# #UNINDENT# if ( filter is not None ) : #NEWLINE# #INDENT# options . options . filter = filter #NEWLINE# #UNINDENT# log_urls = fetch_logs . FetchLogs ( opener , api_host ) #NEWLINE# log_urls = [ log_url for log_url in log_urls if ( 'Operation' not in log_url [ 'url' ] ) ] #NEWLINE# self . assertEqual ( len ( exp_logs ) , len ( log_urls ) ) #NEWLINE# for ( exp_log , log_url ) in zip ( exp_logs , log_urls ) : #NEWLINE# #INDENT# self . assertTrue ( log_url [ 'filename' ] . endswith ( exp_log . client_id ) ) #NEWLINE# self . assertTrue ( log_url [ 'url' ] . endswith ( exp_log . client_id ) ) #NEWLINE# with open ( log_url [ 'local_filename' ] , 'r' ) as f : #NEWLINE# #INDENT# contents = f . read ( ) #NEWLINE# #UNINDENT# self . assertEqual ( exp_log . contents , contents ) #NEWLINE# #UNINDENT# return log_urls