aliyunpan/internal/syncdrive/sync_task_mgr_test.go

34 lines
665 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",
SyncOption{},
2022-05-24 19:56:06 +08:00
)
2022-06-17 10:27:53 +08:00
manager.Start(nil)
2022-06-10 13:55:00 +08:00
time.Sleep(30 * time.Minute)
2022-05-24 19:56:06 +08:00
manager.Stop()
}