@@ -29,11 +29,12 @@ 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'
33+ ' as "Price"' ,
3334 init_url = '/sqleditor/initialize/sqleditor/{0}/{1}/{2}/{3}' ,
3435 donwload_url = "/sqleditor/query_tool/download/{0}" ,
35- output_columns = '"A","B","C"' ,
36- output_values = '1,2,3' ,
36+ output_columns = '"A","B","C","Price" ' ,
37+ output_values = '1,2,3,2300 ' ,
3738 is_valid_tx = True ,
3839 is_valid = True ,
3940 download_as_txt = False ,
@@ -205,17 +206,17 @@ def runTest(self):
205206 # when valid query
206207 self .assertEqual (response .status_code , 200 )
207208 csv_data = response .data .decode ()
208- self .assertTrue (self .output_columns in csv_data )
209- self .assertTrue (self .output_values in csv_data )
209+ self .assertIn (self .output_columns , csv_data )
210+ self .assertIn (self .output_values , csv_data )
210211 self .assertIn ('text/csv' , headers ['Content-Type' ])
211212 self .assertIn (self .filename , headers ['Content-Disposition' ])
212213 elif not self .is_valid and self .is_valid_tx :
213214 # When user enters wrong query
214215 self .assertEqual (response .status_code , 200 )
215216 response_data = json .loads (response .data .decode ('utf-8' ))
216217 self .assertFalse (response_data ['data' ]['status' ])
217- self .assertTrue (
218- 'relation "this_table_does_not_exist" does not exist' in
218+ self .assertIn (
219+ 'relation "this_table_does_not_exist" does not exist' ,
219220 response_data ['data' ]['result' ]
220221 )
221222 else :
0 commit comments