You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
575 B
26 lines
575 B
package dao |
|
|
|
import ( |
|
"bytes" |
|
"context" |
|
"testing" |
|
|
|
. "github.com/smartystreets/goconvey/convey" |
|
) |
|
|
|
func Test_UploadSql(t *testing.T) { |
|
Convey("upload picture or log file to bfs", t, WithMysql(func(d *Dao) { |
|
var ( |
|
fileName = "bilibili.png" |
|
fileType = "png" |
|
expire int64 = 1 |
|
bt = []byte("/9j/4QAo.Reader(bt)YRXhpZgAASUkqAAgAAAAAAAAAAAAAA") |
|
body = bytes.NewReader(bt) |
|
) |
|
_, err := d.Upload(context.Background(), fileName, fileType, expire, body) |
|
if err == errUpload { |
|
err = nil |
|
} |
|
So(err, ShouldBeNil) |
|
})) |
|
}
|
|
|