123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- package client
- import (
- "io/ioutil"
- "jygit.jydev.jianyu360.cn/BaseService/ossService/entity"
- "testing"
- )
- var (
- rpcAddress = "127.0.0.1:8011"
- bucketID = "all"
- txtFileName = "abcd.txt"
- imgFileName = "qie.jpeg"
- )
- // rpc方式上传附件
- func TestUploadFileByRpc(t *testing.T) {
- b, _ := ioutil.ReadFile("./" + imgFileName)
- t.Log(UpLoadByRpc(rpcAddress, &entity.UploadArgs{
- Gzip: true,
- Stream: b,
- BucketID: bucketID,
- ObjectName: imgFileName,
- }))
- }
- // rpc方式上传正文
- func TestUploadTextByRpc(t *testing.T) {
- t.Log(UpLoadByRpc(rpcAddress, &entity.UploadArgs{
- Gzip: true,
- Stream: []byte("这是一段标讯正文"),
- BucketID: bucketID,
- ObjectName: txtFileName,
- }))
- }
- // rpc方式下载
- func TestDownloadTextByRpc(t *testing.T) {
- t.Log(DownloadByRpc(rpcAddress, &entity.Args{
- BucketID: bucketID,
- ObjectName: txtFileName,
- }))
- }
- // rpc方式删除
- func TestDeleteByRpc(t *testing.T) {
- t.Log(DeleteByRpc(rpcAddress, &entity.Args{
- BucketID: bucketID,
- ObjectName: txtFileName,
- }))
- }
|