@@ -30,21 +30,35 @@ def setUp(self):
30
30
global_api = CellsApi (AuthUtil .GetClientId (),AuthUtil .GetClientSecret (),"v3.0" ,AuthUtil .GetBaseUrl ())
31
31
self .api = global_api
32
32
def test_one_case (self ):
33
- cellsApi = CellsApi (AuthUtil .GetClientId (),AuthUtil .GetClientSecret ())
34
- convertOption = ConvertWorkbookOptions ()
35
- convertOption .convert_format = 'png'
36
- convertOption .file_info = FileInfo ()
37
- convertOption .file_info .filename = "Book1.xlsx"
38
- with open ("TestData/Book1.xlsx" , "rb" ) as excel_file :
39
- convertOption .file_info .file_content = base64 .b64encode (excel_file .read ()).decode ("utf-8" )
40
- convertOption .page_setup = PageSetup ()
41
- convertOption .page_setup .print_headings = True
42
- convertWorkbookRequest = PostConvertWorkbookRequest (convertOption )
43
- fileInfo = cellsApi .post_convert_workbook (convertWorkbookRequest )
44
- file_bytes = base64 .b64decode (fileInfo .file_content )
45
-
46
- with open (fileInfo .filename , "wb" ) as f :
47
- f .write (file_bytes )
33
+ remote_folder = 'TestData/In'
34
+
35
+ local_name = 'Book1.xlsx'
36
+ remote_name = 'Book1.xlsx'
37
+
38
+ result = AuthUtil .Ready (self .api , local_name , remote_folder + '/' + remote_name , '' )
39
+ self .assertTrue (len (result .uploaded ) > 0 )
40
+
41
+ request = PutWorksheetFilterRequest (remote_name , 'Sheet1' , 'A1:B1' , 0 , 'Year' , match_blanks = False , refresh = True ,
42
+ folder = remote_folder , storage_name = '' )
43
+ self .api .put_worksheet_filter (request )
44
+
45
+ # cellsApi = CellsApi(AuthUtil.GetClientId(),AuthUtil.GetClientSecret())
46
+ # convertOption = ConvertWorkbookOptions ()
47
+ # convertOption.convert_format = 'png'
48
+ # convertOption.file_info = FileInfo()
49
+ # convertOption.file_info.filename = "Book1.xlsx"
50
+ # with open("TestData/Book1.xlsx", "rb") as excel_file:
51
+ # convertOption.file_info.file_content = base64.b64encode(excel_file.read()).decode("utf-8")
52
+ # convertOption.page_setup = PageSetup()
53
+ # convertOption.page_setup.print_headings = True
54
+ # convertWorkbookRequest = PostConvertWorkbookRequest(convertOption)
55
+ # fileInfo = cellsApi.post_convert_workbook(convertWorkbookRequest)
56
+ # file_bytes = base64.b64decode(fileInfo.file_content)
57
+ #
58
+ # with open(fileInfo.filename, "wb") as f:
59
+ # f.write(file_bytes)
60
+
61
+
48
62
# remote_folder = 'TestData/In'
49
63
50
64
0 commit comments