qiniu_test.go 643 B

123456789101112131415161718192021222324252627
  1. package store
  2. import (
  3. "git.wanbits.cc/sin/flytalk/config"
  4. "testing"
  5. )
  6. func TestQn_Upload(t *testing.T) {
  7. c := config.CreateQiniu("/home/yyk/github/flytalk/" + config.QiniuFile)
  8. t.Log(c)
  9. q := NewQn(c.Access, c.Secret, c.Bucket, c.Zone)
  10. f, err := q.Upload("/home/yyk/github/shotshock/assets/img/gongzhonghao.jpg")
  11. if err != nil {
  12. t.Error(err)
  13. }
  14. t.Log(f)
  15. }
  16. func TestQn_Delete(t *testing.T) {
  17. c := config.CreateQiniu("/home/yyk/github/flytalk/" + config.QiniuFile)
  18. t.Log(c)
  19. q := NewQn(c.Access, c.Secret, c.Bucket, c.Zone)
  20. err := q.Delete("http://twongpicd.shotshock.shop/gongzhonghao.jpg")
  21. if err != nil {
  22. t.Error(err)
  23. }
  24. }