aliyunpan/internal/syncdrive/sync_task_mgr_test.go

39 lines
722 B
Go
Raw Normal View History

2022-05-24 19:56:06 +08:00
package syncdrive
import (
"fmt"
"github.com/tickstep/aliyunpan-api/aliyunpan"
"testing"
"time"
)
func TestStart(t *testing.T) {
2022-06-10 13:55:00 +08:00
refreshToken := "1640cc2d4ea...6b8ccb4d6242161a7"
2022-05-24 19:56:06 +08:00
webToken, err := aliyunpan.GetAccessTokenFromRefreshToken(refreshToken)
if err != nil {
fmt.Println("get acccess token error")
return
}
// pan client
panClient := aliyunpan.NewPanClient(*webToken, aliyunpan.AppLoginToken{})
user, _ := panClient.GetUserInfo()
manager := NewSyncTaskManager(
2022-06-14 21:05:40 +08:00
nil,
2022-05-24 19:56:06 +08:00
user.FileDriveId,
panClient,
2022-06-10 13:55:00 +08:00
"D:\\smb\\feny\\goprojects\\dev\\sync_drive",
1,
1,
int64(256*1024),
aliyunpan.DefaultChunkSize,
2022-06-10 14:36:52 +08:00
false,
2022-06-12 17:03:05 +08:00
0, 0,
2022-05-24 19:56:06 +08:00
)
manager.Start()
2022-06-10 13:55:00 +08:00
time.Sleep(30 * time.Minute)
2022-05-24 19:56:06 +08:00
manager.Stop()
}