service_test.go 501 B

12345678910111213141516171819202122232425262728293031323334
  1. package service
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "strings"
  7. "time"
  8. "go-common/app/admin/ep/merlin/conf"
  9. "gopkg.in/h2non/gock.v1"
  10. )
  11. var (
  12. s *Service
  13. c context.Context
  14. )
  15. func init() {
  16. dir, _ := filepath.Abs("../cmd/convey-test.toml")
  17. flag.Set("conf", dir)
  18. conf.Init()
  19. s = New(conf.Conf)
  20. c = context.Background()
  21. time.Sleep(time.Second)
  22. s.dao.SetProxy()
  23. }
  24. func httpMock(method, url string) *gock.Request {
  25. r := gock.New(url)
  26. r.Method = strings.ToUpper(method)
  27. return r
  28. }