dao_test.go 495 B

1234567891011121314151617181920212223242526272829303132
  1. package dao
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "strings"
  7. "go-common/app/job/main/credit-timer/conf"
  8. _ "github.com/go-sql-driver/mysql"
  9. "gopkg.in/h2non/gock.v1"
  10. )
  11. var d *Dao
  12. func init() {
  13. dir, _ := filepath.Abs("../cmd/convey-test.toml")
  14. flag.Set("conf", dir)
  15. conf.Init()
  16. d = New(conf.Conf)
  17. }
  18. func httpMock(method, url string) *gock.Request {
  19. r := gock.New(url)
  20. r.Method = strings.ToUpper(method)
  21. return r
  22. }
  23. func ctx() context.Context {
  24. return context.Background()
  25. }