-
Notifications
You must be signed in to change notification settings - Fork 0
/
security_test.go
29 lines (26 loc) · 698 Bytes
/
security_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
package ufile
import (
"testing"
// "fmt"
)
func Test_uploadSignedStr(t *testing.T) {
SetConfig(testNewConfig())
str := uploadSignedStr("1111", "ymj", "image/png")
// expectedStr := signature("PUT\n\nimage/png\n\n/ymj/1111")
expectedStr := "sCTyUSEJ+O1VAiOIg0NVLUeATIk="
if str != expectedStr {
t.Error("test uploadSignedStr failed")
} else {
t.Log("test uploadSignedStr passed")
}
}
func Test_downloadSignedStr(t *testing.T) {
SetConfig(testNewConfig())
str := downloadSignedStr("1111", "ymj", "1504513724")
expectedStr := "y6eecjZwALQoPPC0obMzR1NYtsc="
if str != expectedStr {
t.Error("test downloadSignedStr failed")
} else {
t.Log("test downloadSignedStr passed")
}
}