-
Notifications
You must be signed in to change notification settings - Fork 0
/
ufile_test.go
38 lines (34 loc) · 934 Bytes
/
ufile_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
package ufile
import (
"testing"
// "fmt"
)
// 测试上传失败的情况,配置错误
// 使用正确配置可以上传成功,暂时不知道如何mock http请求,后续继续完善
func TestUploadFailed(t *testing.T) {
SetConfig(testNewConfig())
success, _ := Upload("./ufile_test.go", "ufile_go_testing_file", "ymjimages")
// fmt.Println(err)
if success {
t.Error("test Upload failed")
} else {
t.Log("test Upload passed")
}
}
func Test_uploadUrl(t *testing.T) {
SetConfig(testNewConfig())
if uploadUrl("1111", "ymj") == "http:https://ymj.cn-bj.ufileos.com/1111" {
t.Log("test uploadUrl passed")
} else {
t.Error("test uploadUrl failed")
}
}
// 只简单调用了一次,测试待完善: mock time
func TestPrivateCloudUrl(t *testing.T) {
SetConfig(testNewConfig())
if PrivateCloudUrl("1111", "ymj") != "" {
t.Log("test PrivateCloudUrl passed")
} else {
t.Error("test PrivateCloudUrl failed")
}
}