-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbiliup_test.go
65 lines (62 loc) · 1.14 KB
/
biliup_test.go
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
package biliup
import (
"biliup/bilibili"
"fmt"
"github.com/aws/aws-sdk-go/service/s3"
"os"
"testing"
)
func TestBilibiliUpload(t *testing.T) {
type args struct {
filePath string
}
f, err := os.Open("cookies.json")
if err != nil {
t.Error(err)
}
U, err := bilibili.GetUserConfFromFile(f)
if err != nil {
t.Error(err)
}
B, err := Build(*U, bilibili.Name)
B.SetUploadLine(bilibili.Ws)
B.SetThreads(10)
B.(*bilibili.Bilibili).VideoInfos = bilibili.VideoInfos{
Tid: 171,
Title: "test",
Tag: []string{"test"},
Source: "test",
Copyright: 2,
Description: "test",
}
tests := struct {
name string
args args
wantErr bool
}{
name: "TestUploadAndSubmit",
args: args{
filePath: "./test.flv",
},
// TODO: Add test cases.
}
s3.New(nil)
t.Run(tests.name, func(t *testing.T) {
file, err := os.Open(tests.args.filePath)
if err != nil {
t.Error("File not existing")
}
v, err := B.UploadFile(file)
if err != nil {
t.Error(err)
}
resI, err := B.Submit([]*UploadRes{
v,
})
res := resI.(*bilibili.SubmitRes)
fmt.Println(res)
if err != nil {
t.Error(err)
}
})
}