-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathupload_test.go
More file actions
41 lines (31 loc) 路 837 Bytes
/
Copy pathupload_test.go
File metadata and controls
41 lines (31 loc) 路 837 Bytes
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
package main
import (
"strings"
"testing"
)
const testUrl string = "https://encrypted.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"
const testFile string = "test.png"
func TestFileUpload(t *testing.T) {
var err error
if _, err = UploadFile(testFile, defaultTarget); err != nil {
t.Error(err)
}
if _, err = UploadFile(testFile, "google"); err != nil {
t.Error(err)
}
if _, err = UploadURL(testFile, "wrong"); !strings.Contains(err.Error(), "No link") {
t.Error(err)
}
}
func TestUrlUpload(t *testing.T) {
var err error
if _, err = UploadURL(testUrl, defaultTarget); err != nil {
t.Error(err)
}
if _, err = UploadURL(testUrl, "google, yandex"); err != nil {
t.Error(err)
}
if _, err = UploadURL(testUrl, "wrong"); !strings.Contains(err.Error(), "No link") {
t.Error(err)
}
}