2828unique = str (time .gmtime ().tm_sec )
2929group_name = "test-ing-group" + unique
3030workbook_name = "wb_1_" + unique
31- default_project_name = "Personal Work" # "default-proj" + unique
31+ default_project_name = "Personal Work" # "default-proj" + unique
3232parent_location = "parent" + unique
3333project_name = "test-proj-" + unique
3434
4343def _test_command (test_args : list [str ]):
4444 # this will raise an exception if it gets a non-zero return code
4545 # that will bubble up and fail the test
46-
46+
4747 # default: run tests using tabcmd 2
4848 calling_args = ["python" , "-m" , "tabcmd" ] + test_args + [debug_log ] + ["--no-certcheck" ]
4949
@@ -120,7 +120,7 @@ def _publish_creds_args(
120120
121121 def _delete_wb (self , name ):
122122 command = "delete"
123- arguments = [command , "--project" , default_project_name , name ]
123+ arguments = [command , "--project" , default_project_name , name ]
124124 _test_command (arguments )
125125
126126 def _delete_ds (self , name ):
@@ -142,20 +142,17 @@ def _get_custom_view(self):
142142 # TODO
143143 command = "get"
144144
145-
146-
147145 def _export_wb (self , friendly_name , filename = None , additional_args = None ):
148146 command = "export"
149147 arguments = [command , friendly_name , "--fullpdf" ]
150-
148+
151149 if filename :
152150 arguments = arguments + ["--filename" , filename ]
153151 if additional_args :
154152 arguments = arguments + additional_args
155153 _test_command (arguments )
156154
157-
158- def _export_view (self , wb_name_on_server , sheet_name , export_type , filename = None , additional_args = None ):
155+ def _export_view (self , wb_name_on_server , sheet_name , export_type , filename = None , additional_args = None ):
159156 server_file = "/" + wb_name_on_server + "/" + sheet_name
160157 command = "export"
161158 arguments = [command , server_file , export_type ]
@@ -180,15 +177,15 @@ def _get_datasource(self, server_file):
180177
181178 def _create_extract (self , type , wb_name ):
182179 command = "createextracts"
183- arguments = [command , type , wb_name , "--project" , default_project_name ]
180+ arguments = [command , type , wb_name , "--project" , default_project_name ]
184181 if extract_encryption_enabled and not use_tabcmd_classic :
185182 arguments .append ("--encrypt" )
186183 _test_command (arguments )
187184
188185 # variation: url
189186 def _refresh_extract (self , type , wb_name ):
190187 command = "refreshextracts"
191- arguments = [command , "-w" , wb_name , "--project" , default_project_name ] # bug: should not need -w
188+ arguments = [command , "-w" , wb_name , "--project" , default_project_name ] # bug: should not need -w
192189 try :
193190 _test_command (arguments )
194191 except Exception as e :
@@ -202,7 +199,7 @@ def _refresh_extract(self, type, wb_name):
202199
203200 def _delete_extract (self , type , item_name ):
204201 command = "deleteextracts"
205- arguments = [command , type , item_name , "--include-all" , "--project" , default_project_name ]
202+ arguments = [command , type , item_name , "--include-all" , "--project" , default_project_name ]
206203 try :
207204 _test_command (arguments )
208205 except Exception as e :
@@ -379,6 +376,17 @@ def test_view_get_pdf(self):
379376 # bug in tabcmd classic: doesn't work without download name
380377 self ._get_view (wb_name_on_server , sheet_name , "downloaded_file.pdf" )
381378
379+ @pytest .mark .order (11 )
380+ def test_view_get_png_sizes (self ):
381+ wb_name_on_server = OnlineCommandTest .TWBX_WITH_EXTRACT_NAME
382+ sheet_name = OnlineCommandTest .TWBX_WITH_EXTRACT_SHEET
383+
384+ self ._get_view (wb_name_on_server , sheet_name , "get_view_default_size.png" )
385+ url_params = "?:size=100,200"
386+ self ._get_view (wb_name_on_server , sheet_name + url_params , "get_view_sized_sm.png" )
387+ url_params = "?:size=500,700"
388+ self ._get_view (wb_name_on_server , sheet_name + url_params , "get_view_sized_LARGE.png" )
389+
382390 @pytest .mark .order (11 )
383391 def test_view_get_csv (self ):
384392 wb_name_on_server = OnlineCommandTest .TWBX_WITH_EXTRACT_NAME
@@ -451,21 +459,18 @@ def test__delete_ds_live(self):
451459 def test_export_wb_filters (self ):
452460 wb_name_on_server = OnlineCommandTest .TWBX_WITH_EXTRACT_NAME
453461 sheet_name = OnlineCommandTest .TWBX_WITH_EXTRACT_SHEET
454- friendly_name = wb_name_on_server + "/" + sheet_name
455- filters = ["--filter" , "Product Type=Tea" , "--fullpdf" , "--pagelayout" , "landscape" ]
462+ friendly_name = wb_name_on_server + "/" + sheet_name
463+ filters = ["--filter" , "Product Type=Tea" , "--fullpdf" , "--pagelayout" , "landscape" ]
456464 self ._export_wb (friendly_name , "filter_a_wb_to_tea_and_two_pages.pdf" , filters )
457465 # NOTE: this test needs a visual check on the returned pdf to confirm the expected appearance
458466
459467 @pytest .mark .order (19 )
460468 def test_export_wb_pdf (self ):
461- command = "export"
462469 wb_name_on_server = OnlineCommandTest .TWBX_WITH_EXTRACT_NAME
463- friendly_name = (
464- wb_name_on_server + "/" + OnlineCommandTest .TWBX_WITH_EXTRACT_SHEET
465- )
470+ friendly_name = wb_name_on_server + "/" + OnlineCommandTest .TWBX_WITH_EXTRACT_SHEET
466471 filename = "exported_wb.pdf"
467472 self ._export_wb (friendly_name , filename )
468-
473+
469474 @pytest .mark .order (19 )
470475 def test_export_data_csv (self ):
471476 wb_name_on_server = OnlineCommandTest .TWBX_WITH_EXTRACT_NAME
@@ -483,13 +488,13 @@ def test_export_view_pdf(self):
483488 wb_name_on_server = OnlineCommandTest .TWBX_WITH_EXTRACT_NAME
484489 sheet_name = OnlineCommandTest .TWBX_WITH_EXTRACT_SHEET
485490 self ._export_view (wb_name_on_server , sheet_name , "--pdf" , "export_view_pdf.pdf" )
486-
491+
487492 @pytest .mark .order (19 )
488493 def test_export_view_filtered (self ):
489494 wb_name_on_server = OnlineCommandTest .TWBX_WITH_EXTRACT_NAME
490495 sheet_name = OnlineCommandTest .TWBX_WITH_EXTRACT_SHEET
491496 filename = "view_with_filters.pdf"
492-
497+
493498 filters = ["--filter" , "Product Type=Tea" ]
494499 self ._export_view (wb_name_on_server , sheet_name , "--pdf" , filename , filters )
495500
0 commit comments