-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtests_folder_controller.py
94 lines (66 loc) · 2.93 KB
/
tests_folder_controller.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# coding: utf-8
from __future__ import absolute_import
import os
import sys
import unittest
import warnings
import time
ABSPATH = os.path.abspath(os.path.realpath(os.path.dirname(__file__)) + "/..")
sys.path.append(ABSPATH)
from asposecellscloud.rest import ApiException
from asposecellscloud.apis.cells_api import CellsApi
import AuthUtil
from asposecellscloud.models import *
from asposecellscloud.requests import *
global_api = None
class TestFolderControllerApi(unittest.TestCase):
def setUp(self):
warnings.simplefilter('ignore', ResourceWarning)
global global_api
if global_api is None:
global_api = CellsApi(AuthUtil.GetClientId(),AuthUtil.GetClientSecret(),"v3.0",AuthUtil.GetBaseUrl())
self.api = global_api
def tearDown(self):
pass
def test_get_files_list(self):
remote_folder = 'TestData/In'
local_name = 'Book1.xlsx'
remote_name = 'Book1.xlsx'
result = AuthUtil.Ready(self.api, local_name, remote_folder + '/' + remote_name , '')
self.assertTrue(len(result.uploaded)>0)
request = GetFilesListRequest(path= remote_folder,storage_name= '')
self.api.get_files_list(request)
def test_create_folder(self):
remote_folder = 'TestData/In'
local_name = 'Book1.xlsx'
remote_name = 'Book1.xlsx'
result = AuthUtil.Ready(self.api, local_name, remote_folder + '/' + remote_name , '')
self.assertTrue(len(result.uploaded)>0)
request = CreateFolderRequest( 'OutResult/NewFolder',storage_name= '')
self.api.create_folder(request)
def test_copy_folder(self):
remote_folder = 'TestData/In'
local_name = 'Book1.xlsx'
remote_name = 'Book1.xlsx'
result = AuthUtil.Ready(self.api, local_name, remote_folder + '/' + remote_name , '')
self.assertTrue(len(result.uploaded)>0)
request = CopyFolderRequest( remote_folder, 'OutResult/Create',src_storage_name= '',dest_storage_name= '')
self.api.copy_folder(request)
def test_move_folder(self):
remote_folder = 'TestData/In'
local_name = 'Book1.xlsx'
remote_name = 'Book1.xlsx'
result = AuthUtil.Ready(self.api, local_name, remote_folder + '/' + remote_name , '')
self.assertTrue(len(result.uploaded)>0)
request = MoveFolderRequest( 'OutResult/Create', 'OutResult/Move',src_storage_name= '',dest_storage_name= '')
self.api.move_folder(request)
def test_delete_folder(self):
remote_folder = 'TestData/In'
local_name = 'Book1.xlsx'
remote_name = 'Book1.xlsx'
result = AuthUtil.Ready(self.api, local_name, remote_folder + '/' + remote_name , '')
self.assertTrue(len(result.uploaded)>0)
request = DeleteFolderRequest( 'OutResult/Create',storage_name= '',recursive= True)
self.api.delete_folder(request)
if __name__ == '__main__':
unittest.main()