dao_test.go 754 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package upload
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "strings"
  7. "testing"
  8. "go-common/app/admin/main/credit/conf"
  9. . "github.com/smartystreets/goconvey/convey"
  10. "gopkg.in/h2non/gock.v1"
  11. )
  12. var d *Dao
  13. func init() {
  14. dir, _ := filepath.Abs("../cmd/convey-test.toml")
  15. flag.Set("conf", dir)
  16. conf.Init()
  17. d = New(conf.Conf)
  18. }
  19. func WithDao(f func(d *Dao)) func() {
  20. return func() {
  21. f(d)
  22. }
  23. }
  24. func httpMock(method, url string) *gock.Request {
  25. r := gock.New(url)
  26. r.Method = strings.ToUpper(method)
  27. return r
  28. }
  29. func ctx() context.Context {
  30. return context.Background()
  31. }
  32. func Test_Upload(t *testing.T) {
  33. Convey("return someting", t, func() {
  34. _, err := d.Upload(context.TODO(), "blocked_info", "", 12313, nil)
  35. So(err, ShouldBeNil)
  36. })
  37. }