🎇 支持mysql

This commit is contained in:
微凉
2021-03-16 23:15:37 +08:00
parent 4d0d892ce7
commit a5b2f998ab
15 changed files with 85 additions and 89 deletions

View File

@@ -1,47 +0,0 @@
package test
import (
"fmt"
"github.com/Xhofe/alist/alidrive"
"github.com/Xhofe/alist/bootstrap"
"github.com/Xhofe/alist/conf"
"os"
"testing"
)
func setup() {
bootstrap.InitLog()
bootstrap.ReadConf("../conf.yml")
bootstrap.InitClient()
bootstrap.InitAliDrive()
}
func TestGetUserInfo(t *testing.T) {
user, err := alidrive.GetUserInfo()
fmt.Println(err)
fmt.Println(user)
}
func TestGetRoot(t *testing.T) {
files, err := alidrive.GetRoot(50, "", conf.OrderUpdatedAt, conf.DESC)
fmt.Println(err)
fmt.Println(files)
}
func TestSearch(t *testing.T) {
files, err := alidrive.Search("测试文件", 50, "")
fmt.Println(err)
fmt.Println(files)
}
func TestGet(t *testing.T) {
file, err := alidrive.GetFile("5fb7c80e85e4f335cd344008be1b1b5349f74414")
fmt.Println(err)
fmt.Println(file)
}
func TestMain(m *testing.M) {
setup()
code := m.Run()
os.Exit(code)
}

View File

@@ -15,18 +15,18 @@ func TestSplit(t *testing.T) {
}
func TestPassword(t *testing.T) {
fullName:="hello.password-xhf"
index:=strings.Index(fullName,".password-")
name:=fullName[:index]
password:=fullName[index+10:]
fmt.Printf("name:%s, password:%s\n",name,password)
fullName := "hello.password-xhf"
index := strings.Index(fullName, ".password-")
name := fullName[:index]
password := fullName[index+10:]
fmt.Printf("name:%s, password:%s\n", name, password)
}
func TestDir(t *testing.T) {
dir,file:=filepath.Split("root")
fmt.Printf("dir:%s\nfile:%s\n",dir,file)
dir, file := filepath.Split("root")
fmt.Printf("dir:%s\nfile:%s\n", dir, file)
}
func TestMD5(t *testing.T) {
fmt.Printf("%s\n", utils.Get16MD5Encode("123456"))
}
}

View File

@@ -2,7 +2,6 @@ package test
import (
"fmt"
"github.com/Xhofe/alist/alidrive"
"github.com/Xhofe/alist/conf"
"github.com/Xhofe/alist/utils"
"testing"
@@ -13,7 +12,5 @@ func TestStr(t *testing.T) {
}
func TestWriteYml(t *testing.T) {
alidrive.RefreshToken()
utils.WriteToYml("../conf.yml", conf.Conf)
}