@@ -29,11 +29,11 @@ class TestDownloadCSV(BaseTestGenerator):
2929 (
3030 'Download csv URL with valid query' ,
3131 dict (
32- sql = 'SELECT 1 as "A",2 as "B",3 as "C"' ,
32+ sql = 'SELECT 1 as "A",2 as "B",3 as "C",2300::numeric as "Price" ' ,
3333 init_url = '/sqleditor/initialize/sqleditor/{0}/{1}/{2}/{3}' ,
3434 donwload_url = "/sqleditor/query_tool/download/{0}" ,
35- output_columns = '"A","B","C"' ,
36- output_values = '1,2,3' ,
35+ output_columns = '"A","B","C","Price" ' ,
36+ output_values = '1,2,3,2300 ' ,
3737 is_valid_tx = True ,
3838 is_valid = True ,
3939 download_as_txt = False ,
@@ -205,17 +205,17 @@ def runTest(self):
205205 # when valid query
206206 self .assertEqual (response .status_code , 200 )
207207 csv_data = response .data .decode ()
208- self .assertTrue (self .output_columns in csv_data )
209- self .assertTrue (self .output_values in csv_data )
208+ self .assertIn (self .output_columns , csv_data )
209+ self .assertIn (self .output_values , csv_data )
210210 self .assertIn ('text/csv' , headers ['Content-Type' ])
211211 self .assertIn (self .filename , headers ['Content-Disposition' ])
212212 elif not self .is_valid and self .is_valid_tx :
213213 # When user enters wrong query
214214 self .assertEqual (response .status_code , 200 )
215215 response_data = json .loads (response .data .decode ('utf-8' ))
216216 self .assertFalse (response_data ['data' ]['status' ])
217- self .assertTrue (
218- 'relation "this_table_does_not_exist" does not exist' in
217+ self .assertIn (
218+ 'relation "this_table_does_not_exist" does not exist' ,
219219 response_data ['data' ]['result' ]
220220 )
221221 else :
0 commit comments