param_test.go 674 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package param
  2. import (
  3. "flag"
  4. "path/filepath"
  5. "testing"
  6. "time"
  7. "go-common/app/interface/main/app-resource/conf"
  8. "go-common/app/interface/main/app-resource/model"
  9. . "github.com/smartystreets/goconvey/convey"
  10. )
  11. var (
  12. s *Service
  13. )
  14. func WithService(f func(s *Service)) func() {
  15. return func() {
  16. f(s)
  17. }
  18. }
  19. func init() {
  20. dir, _ := filepath.Abs("../../cmd/app-resource-test.toml")
  21. flag.Set("conf", dir)
  22. conf.Init()
  23. s = New(conf.Conf)
  24. time.Sleep(time.Second)
  25. }
  26. func TestParam(t *testing.T) {
  27. Convey("get Param data", t, WithService(func(s *Service) {
  28. res, _, err := s.Param(model.PlatIPhone, 1, "")
  29. So(res, ShouldNotBeEmpty)
  30. So(err, ShouldBeNil)
  31. }))
  32. }