#NEWLINE# def testDownloadPqlResultSetToCsv( self ) : #NEWLINE# #INDENT# csv_file = StringIO . StringIO ( ) #NEWLINE# self . pql_service . select . return_value = { #NEWLINE# #INDENT# 'rows' : self . generic_rval , #NEWLINE# 'columnTypes' : self . generic_header , #NEWLINE# #UNINDENT# } #NEWLINE# self . report_downloader . DownloadPqlResultToCsv ( 'SELECT Id, Name FROM Line_Item' , self ) #NEWLINE# csv_file . seek ( 0 ) #NEWLINE# self . assertEqual ( csv_file . readline ( ) , '"Some random header...","Another header..."\r\n' ) #NEWLINE# self . assertEqual ( csv_file . readline ( ) , '"Some random PQL response...","1999-04-03","123","2012-11-05T12:12:12-08:00","-","""Whatcha thinkin about?"",""Oh nothing, just String stuff..."""\r\n' ) #NEWLINE# self . assertEqual ( csv_file . readline ( ) , '"A second row of PQL response!","2009-02-05","345","2013-01-03T02:02:02Z","123456","""Look at how many commas and """"s there are"",""this,is...how,Christopher Walken, talks"""\r\n' ) #NEWLINE# csv_file . close ( ) #NEWLINE# self . pql_service . select . assert_called_once_with ( { #NEWLINE# #INDENT# 'values' : None , #NEWLINE# 'query' : 'SELECT Id, Name FROM Line_Item LIMIT 500 OFFSET 0' , #NEWLINE# #UNINDENT# } )