12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package weedcl
- import (
- "fmt"
- "log"
- "net/http"
- "testing"
- )
- func Test_assign(t *testing.T) {
- c := NewClient("http://192.168.3.14:9333")
- fid, url, publicurl, err := c.assign()
- fmt.Println(fid, url, publicurl, err)
- }
- func Test_upload(t *testing.T) {
- c := NewClient("http://192.168.3.14:9333")
- fid, publicurl, err := c.Upload("/Users/zhp/projects/jy/app.json")
- log.Println(fid, publicurl, err)
- }
- //上传网络资源
- func Test_upload2(t *testing.T) {
- resp, _ := http.Get("http://fanyi.baidu.com/static/translation/img/header/logo_cbfea26.png")
- defer resp.Body.Close()
- c := NewClient("http://192.168.3.14:9333")
- fid, publicurl, err := c.UploadFromReader("baidu_icon.png", resp.Body)
- log.Println(fid, publicurl, err)
- }
- func Test_delete(t *testing.T) {
- c := NewClient("http://192.168.3.14:9333")
- err := c.Delete("27,0e6846633a", "192.168.3.14:9888")
- log.Println(err)
- }
- func Test_update(t *testing.T) {
- resp, _ := http.Get("http://cdn.chinaz.com/tools/images/public/logos/logo-index.png")
- defer resp.Body.Close()
- c := NewClient("http://192.168.3.14:9333")
- fid, publicurl, err := c.UpdateFromReader("baidu_icon.png", "192.168.3.14:9888", "23,0f970140b1", resp.Body)
- log.Println(fid, publicurl, err)
- }
|